File Coverage

blib/lib/Dancer2/Template/Handlebars/Helpers.pm
Criterion Covered Total %
statement 20 20 100.0
branch 1 2 50.0
condition 2 2 100.0
subroutine 6 6 100.0
pod 0 2 0.0
total 29 32 90.6


line stmt bran cond sub pod time code
1             package Dancer2::Template::Handlebars::Helpers 0.3;
2              
3             # ABSTRACT: parent class for Handlebars' helper collections
4              
5 1     1   1071 use strict;
  1         3  
  1         31  
6 1     1   5 use warnings;
  1         2  
  1         25  
7              
8 1     1   508 use Sub::Attribute;
  1         520  
  1         176  
9              
10             my %HELPERS;
11              
12             sub HANDLEBARS_HELPERS {
13 1     1 0 17 my $class = shift;
14 1 50       2 %{ $HELPERS{$class} || {} };
  1         7  
15             }
16              
17             sub Helper : ATTR_SUB {
18 2     2 0 345 my ( $class, $sym_ref, undef, undef, $attr_data ) = @_;
19              
20 2         5 my $fname = $class . '::' . *{$sym_ref}{NAME};
  2         5  
21 2   100     9 my $helper_name = $attr_data || *{$sym_ref}{NAME};
22              
23 2         17 $HELPERS{$class}{$helper_name} = \&$fname;
24 1     1   8 }
  1         2  
  1         8  
25              
26             1;
27              
28             __END__