line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Xslate::HashWithDefault; |
2
|
3
|
|
|
3
|
|
15
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
117
|
|
3
|
|
|
|
|
|
|
|
4
|
3
|
|
|
3
|
|
2636
|
use Tie::Hash; |
|
3
|
|
|
|
|
2928
|
|
|
3
|
|
|
|
|
428
|
|
5
|
|
|
|
|
|
|
our @ISA = qw(Tie::ExtraHash); |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub TIEHASH { |
8
|
5
|
|
|
5
|
|
20
|
my($class, $storage, $default) = @_; |
9
|
5
|
|
|
|
|
25
|
return bless [ $storage, $default ], $class; |
10
|
|
|
|
|
|
|
} |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub FETCH { |
13
|
12
|
|
|
12
|
|
59
|
my($self, $key) = @_; |
14
|
12
|
100
|
|
|
|
47
|
if(exists $self->[0]{$key}) { |
15
|
3
|
|
|
|
|
26
|
return $self->[0]{$key}; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
else { |
18
|
9
|
100
|
|
|
|
56
|
return ref($self->[1]) eq 'CODE' |
19
|
|
|
|
|
|
|
? $self->[1]->($key) |
20
|
|
|
|
|
|
|
: $self->[1]; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
1; |
25
|
|
|
|
|
|
|
__END__ |