File Coverage

blib/lib/Dancer/Template/Handlebars/Helpers.pm
Criterion Covered Total %
statement 18 18 100.0
branch 1 2 50.0
condition 2 2 100.0
subroutine 6 6 100.0
pod 0 1 0.0
total 27 29 93.1


line stmt bran cond sub pod time code
1             package Dancer::Template::Handlebars::Helpers;
2             BEGIN {
3 2     2   1803 $Dancer::Template::Handlebars::Helpers::AUTHORITY = 'cpan:YANICK';
4             }
5             # ABSTRACT: parent class for Handlebars' helper collections
6             $Dancer::Template::Handlebars::Helpers::VERSION = '0.2.1';
7              
8 2     2   13 use strict;
  2         4  
  2         64  
9 2     2   11 use warnings;
  2         7  
  2         63  
10              
11 2     2   2869 use Sub::Attribute;
  2         7561  
  2         396  
12              
13             sub Helper :ATTR_SUB {
14 4     4 0 821 my( $class, $sym_ref, $code_ref, $attr_name, $attr_data ) = @_;
15              
16 4         5 my $fname = *{ $sym_ref }{NAME};
  4         43  
17 4   100     20 my $helper_name = $attr_data || *{ $sym_ref }{NAME};
18              
19 4 50       340 eval qq{
20             package $class;
21             \$${class}::HANDLEBARS_HELPERS{$helper_name} = \\\&$fname;
22             } or die $@;
23 2     2   20 }
  2         4  
  2         18  
24              
25             1;
26              
27             __END__