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