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