File Coverage

blib/lib/HTML/Template/Compiled/Classic.pm
Criterion Covered Total %
statement 22 23 95.6
branch 4 4 100.0
condition 2 2 100.0
subroutine 7 7 100.0
pod 2 2 100.0
total 37 38 97.3


line stmt bran cond sub pod time code
1             package HTML::Template::Compiled::Classic;
2 1     1   948 use strict;
  1         2  
  1         21  
3 1     1   2 use warnings;
  1         1  
  1         30  
4             our $VERSION = '1.002_001'; # TRIAL VERSION
5              
6 1     1   3 use base 'HTML::Template::Compiled';
  1         0  
  1         65  
7 1     1   319 use HTML::Template::Compiled::Compiler::Classic;
  1         2  
  1         102  
8              
9 3     3 1 15 sub compiler_class { 'HTML::Template::Compiled::Compiler::Classic' }
10              
11             sub _get_var_global_sub {
12 4     4   5 my ($self, $P, $ref, $final, @paths) = @_;
13 4         4 my $key = $paths[0]->[1];
14 4   100     10 my $stack = $self->get_globalstack || [];
15 4         5 for my $item ( $ref, reverse @$stack ) {
16 5 100       9 next unless exists $item->{$key};
17 4         4 my $var = $item->{$key};
18 4 100       10 ref $var eq 'CODE' and $var = $var->();
19 4         91 return $var;
20             }
21 0         0 return;
22             }
23              
24             # returns if the var is valid
25             # only allow '.', '/', '+', '-' and '_'
26             # fix 2012-05-14: HTML::Template allows every character
27             # although the documentation says it doesn't.
28             sub validate_var {
29 7     7 1 16 return 1;
30             # return $_[1] !~ tr#a-zA-Z0-9._/-##c;
31             }
32              
33              
34             1;
35              
36             __END__