line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Hash::RestrictedKeys::Tie; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
74166
|
use strict; |
|
3
|
|
|
|
|
16
|
|
|
3
|
|
|
|
|
92
|
|
4
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
88
|
|
5
|
3
|
|
|
3
|
|
18
|
use Carp qw/croak/; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
1459
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub TIEHASH { |
8
|
2
|
|
|
2
|
|
104
|
my ($class, @keys) = @_; |
9
|
2
|
|
|
|
|
15
|
bless { |
10
|
|
|
|
|
|
|
hash => {}, |
11
|
|
|
|
|
|
|
allowed_keys => \@keys |
12
|
|
|
|
|
|
|
}, $class; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub STORE { |
16
|
8
|
|
|
8
|
|
562
|
$_[0]->{hash}->{$_[0]->VALIDKEY($_[1])} = $_[2]; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub FETCH { |
20
|
6
|
|
|
6
|
|
1502
|
$_[0]->{hash}->{$_[0]->VALIDKEY($_[1])}; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub VALIDKEY { |
24
|
2
|
|
|
|
|
416
|
croak sprintf('Invalid key %s. Allowed keys: %s', $_[1], join( ', ', @{$_[0]->{allowed_keys}})) |
25
|
14
|
100
|
|
14
|
0
|
24
|
unless grep { $_ eq $_[1] } @{$_[0]->{allowed_keys}}; |
|
42
|
|
|
|
|
103
|
|
|
14
|
|
|
|
|
35
|
|
26
|
12
|
|
|
|
|
48
|
return $_[1]; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub FIRSTKEY { |
30
|
0
|
|
|
0
|
|
|
each %{ $_[0]->{hash} }; |
|
0
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub NEXTKEY { |
34
|
0
|
|
|
0
|
|
|
each %{ $_[0]->{hash} }; |
|
0
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub EXISTS { |
38
|
0
|
|
|
0
|
|
|
exists $_[0]->{hash}->{$_[0]->VALIDKEY($_[1])}; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub DELETE { |
42
|
0
|
|
|
0
|
|
|
delete $_[0]->{hash}->{$_[0]->VALIDKEY($_[1])}; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub CLEAR { |
46
|
0
|
|
|
0
|
|
|
%{$_[0]->{hash}} = (); |
|
0
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub SCALAR { |
50
|
0
|
|
|
0
|
|
|
scalar %{$_[0]->{hash}}; |
|
0
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |