line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Hash::DefaultValue; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
81888
|
use 5.006; |
|
4
|
|
|
|
|
14
|
|
|
4
|
|
|
|
|
160
|
|
4
|
4
|
|
|
4
|
|
21
|
use strict; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
154
|
|
5
|
4
|
|
|
4
|
|
22
|
use warnings; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
114
|
|
6
|
4
|
|
|
4
|
|
2133
|
use utf8; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
20
|
|
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
5606
|
use Tie::Hash qw(); |
|
4
|
|
|
|
|
3852
|
|
|
4
|
|
|
|
|
110
|
|
9
|
4
|
|
|
4
|
|
25
|
use Carp qw(croak); |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
251
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use constant { |
12
|
4
|
|
|
|
|
352
|
IDX_HASH => 0, |
13
|
|
|
|
|
|
|
IDX_CODE => 1, |
14
|
|
|
|
|
|
|
NEXT_IDX => 2, |
15
|
4
|
|
|
4
|
|
24
|
}; |
|
4
|
|
|
|
|
8
|
|
16
|
4
|
|
|
4
|
|
23
|
use constant _default => undef; |
|
4
|
|
|
|
|
32
|
|
|
4
|
|
|
|
|
199
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
BEGIN { |
19
|
4
|
|
|
4
|
|
19
|
no warnings 'once'; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
278
|
|
20
|
4
|
|
|
4
|
|
9
|
$Hash::DefaultValue::AUTHORITY = 'cpan:TOBYINK'; |
21
|
4
|
|
|
|
|
6
|
$Hash::DefaultValue::VERSION = '0.006'; |
22
|
4
|
|
|
|
|
1162
|
@Hash::DefaultValue::ISA = qw(Tie::ExtraHash); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub TIEHASH |
26
|
|
|
|
|
|
|
{ |
27
|
5
|
|
|
5
|
|
2866
|
my $class = shift; |
28
|
5
|
100
|
|
|
|
24
|
my $coderef = @_ ? shift : $class->_default; |
29
|
|
|
|
|
|
|
|
30
|
5
|
100
|
|
|
|
20
|
unless (ref $coderef) |
31
|
|
|
|
|
|
|
{ |
32
|
2
|
|
|
|
|
5
|
my $value = $coderef; |
33
|
2
|
|
|
4
|
|
8
|
$coderef = sub { $value }; |
|
4
|
|
|
|
|
26
|
|
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
5
|
50
|
|
|
|
23
|
unless (ref $coderef eq 'CODE') |
37
|
|
|
|
|
|
|
{ |
38
|
0
|
|
|
|
|
0
|
croak "must provide a coderef or non-reference scalar value for $class"; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
5
|
|
|
|
|
43
|
$class->SUPER::TIEHASH($coderef) |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub FETCH |
45
|
|
|
|
|
|
|
{ |
46
|
12
|
|
|
12
|
|
6189
|
my ($this, $key) = @_; |
47
|
12
|
100
|
|
|
|
27
|
$key = '' unless defined $key; |
48
|
|
|
|
|
|
|
|
49
|
12
|
100
|
|
|
|
59
|
unless (exists $this->[IDX_HASH]{$key}) |
50
|
|
|
|
|
|
|
{ |
51
|
9
|
|
|
|
|
14
|
local $_ = $key; |
52
|
9
|
|
|
|
|
36
|
return scalar $this->[IDX_CODE]($this->[IDX_HASH], $key); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
3
|
|
|
|
|
15
|
$this->[IDX_HASH]{$key} |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__PACKAGE__ |
59
|
|
|
|
|
|
|
__END__ |