line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Hash::Lazy::Tie; |
2
|
6
|
|
|
6
|
|
45
|
use strict; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
177
|
|
3
|
6
|
|
|
6
|
|
31
|
use warnings; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
305
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
BEGIN { |
6
|
6
|
|
|
6
|
|
3023
|
require Tie::Hash; |
7
|
6
|
|
|
|
|
5907
|
our @ISA = qw(Tie::ExtraHash); |
8
|
|
|
|
|
|
|
} |
9
|
|
|
|
|
|
|
|
10
|
6
|
|
|
6
|
|
45
|
use Carp qw(confess); |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
262
|
|
11
|
6
|
|
|
6
|
|
2582
|
use self; |
|
6
|
|
|
6
|
|
45909
|
|
|
6
|
|
|
|
|
33
|
|
|
6
|
|
|
|
|
7168
|
|
|
6
|
|
|
|
|
49222
|
|
|
6
|
|
|
|
|
38
|
|
12
|
|
|
|
|
|
|
|
13
|
6
|
|
|
6
|
|
1419
|
use constant USAGE => 'my %h; tie %h, "Hash::Lazy::Tie", $builder, \%h;'; |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
282
|
|
14
|
|
|
|
|
|
|
|
15
|
6
|
|
|
6
|
|
659
|
use constant STORAGE => 0; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
221
|
|
16
|
6
|
|
|
6
|
|
543
|
use constant BUILDER => 1; |
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
251
|
|
17
|
6
|
|
|
6
|
|
544
|
use constant TIED => 2; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
200
|
|
18
|
|
|
|
|
|
|
|
19
|
5
|
|
|
5
|
|
22
|
sub TIEHASH { |
20
|
5
|
|
|
|
|
15
|
my ($builder, $tied) = @args; |
21
|
|
|
|
|
|
|
|
22
|
5
|
50
|
|
|
|
22
|
confess "The use of Hash::Lazy::Tie requires passing the hash variable that it's tying to. Usage: " . USAGE |
23
|
|
|
|
|
|
|
unless defined($tied); |
24
|
|
|
|
|
|
|
|
25
|
5
|
|
|
|
|
28
|
return bless [{}, $builder, $tied], $self; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
93
|
|
|
93
|
|
2600
|
sub FETCH { |
29
|
93
|
|
|
|
|
133
|
my ($key) = @args; |
30
|
|
|
|
|
|
|
|
31
|
93
|
100
|
|
|
|
295
|
return $self->[STORAGE]{$key} if exists $self->[STORAGE]{$key}; |
32
|
|
|
|
|
|
|
|
33
|
37
|
|
|
|
|
100
|
my $ret = $self->[BUILDER]->($self->[TIED], $key); |
34
|
37
|
100
|
|
|
|
125
|
$self->[STORAGE]{$key} = $ret unless exists $self->[STORAGE]{$key}; |
35
|
37
|
|
|
|
|
123
|
return $self->[STORAGE]{$key}; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |