line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Hash::ExtendedKeys::Tie; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
57830
|
use strict; |
|
4
|
|
|
|
|
18
|
|
|
4
|
|
|
|
|
95
|
|
4
|
4
|
|
|
4
|
|
17
|
use warnings; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
87
|
|
5
|
4
|
|
|
4
|
|
1824
|
use Hash::Util qw(fieldhash); |
|
4
|
|
|
|
|
9800
|
|
|
4
|
|
|
|
|
20
|
|
6
|
4
|
|
|
4
|
|
6888
|
use Struct::Match qw/match/; |
|
4
|
|
|
|
|
67473
|
|
|
4
|
|
|
|
|
29
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub TIEHASH { |
9
|
3
|
|
|
3
|
|
77
|
my ($class) = @_; |
10
|
|
|
|
|
|
|
|
11
|
3
|
|
|
|
|
38
|
fieldhash my %fieldhash; |
12
|
|
|
|
|
|
|
|
13
|
3
|
|
|
|
|
63
|
my $self = { |
14
|
|
|
|
|
|
|
fieldhash => \%fieldhash, |
15
|
|
|
|
|
|
|
}; |
16
|
|
|
|
|
|
|
|
17
|
3
|
|
|
|
|
12
|
bless $self, $class; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub STORE { |
21
|
12
|
|
|
12
|
|
827
|
my ($self, $key, $value) = @_; |
22
|
|
|
|
|
|
|
|
23
|
12
|
100
|
|
|
|
59
|
my $k = $self->{fieldhash}->{$key} ? $key : $self->FINDKEY($key);; |
24
|
12
|
100
|
|
|
|
22
|
if ($k) { |
25
|
4
|
|
|
|
|
11
|
$self->{fieldhash}->{$k}->{value} = $value; |
26
|
|
|
|
|
|
|
} else { |
27
|
8
|
|
|
|
|
44
|
$self->{fieldhash}->{$key} = { |
28
|
|
|
|
|
|
|
key => $key, |
29
|
|
|
|
|
|
|
value => $value |
30
|
|
|
|
|
|
|
}; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
12
|
|
|
|
|
33
|
return $self; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub FETCH { |
37
|
12
|
|
|
12
|
|
216
|
my ($self, $key) = @_; |
38
|
12
|
100
|
|
|
|
39
|
my $k = $self->{fieldhash}->{$key} ? $key : $self->FINDKEY($key); |
39
|
12
|
100
|
|
|
|
53
|
return $k ? $self->{fieldhash}->{$k}->{value} : undef; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub FINDKEY { |
43
|
|
|
|
|
|
|
# uncoverable pod |
44
|
19
|
|
|
19
|
0
|
23
|
for my $k (keys %{$_[0]->{fieldhash}}) { |
|
19
|
|
|
|
|
53
|
|
45
|
10
|
100
|
|
|
|
34
|
if (match($_[0]->{fieldhash}->{$k}->{key}, $_[1])) { |
46
|
8
|
|
|
|
|
458
|
return $_[0]->{fieldhash}->{$k}->{key}; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
11
|
|
|
|
|
183
|
return undef; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub FIRSTKEY { |
53
|
4
|
|
|
4
|
|
858
|
my ($key, $value) = each %{$_[0]->{fieldhash}}; |
|
4
|
|
|
|
|
18
|
|
54
|
4
|
|
|
|
|
14
|
return $value->{key}; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub NEXTKEY { |
58
|
4
|
|
|
4
|
|
8
|
my ($key, $value) = each %{$_[0]->{fieldhash}}; |
|
4
|
|
|
|
|
8
|
|
59
|
4
|
|
|
|
|
30
|
return $value->{key}; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub EXISTS { |
63
|
2
|
100
|
|
2
|
|
12
|
my $k = $_[0]->{fieldhash}->{$_[1]} ? $_[1] : $_[0]->FINDKEY($_[1]); |
64
|
2
|
100
|
|
|
|
12
|
$k ? exists $_[0]->{fieldhash}->{$k} : undef; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub DELETE { |
68
|
4
|
100
|
|
4
|
|
21
|
my $k = $_[0]->{fieldhash}->{$_[1]} ? $_[1] : $_[0]->FINDKEY($_[1]); |
69
|
4
|
100
|
|
|
|
23
|
$k ? delete $_[0]->{fieldhash}->{$k} : undef; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub CLEAR { |
73
|
3
|
|
|
3
|
|
1510
|
%{$_[0]->{fieldhash}} = () |
|
3
|
|
|
|
|
11
|
|
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub SCALAR { |
77
|
1
|
|
|
1
|
|
2
|
scalar keys %{$_[0]->{fieldhash}} |
|
1
|
|
|
|
|
5
|
|
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |