line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::KeePass::KDBX::Tie::Hash; |
2
|
|
|
|
|
|
|
# ABSTRACT: Hash base class |
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
895
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
54
|
|
5
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
47
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
10
|
use parent 'Tie::Hash'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
11
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.902'; # VERSION |
10
|
|
|
|
|
|
|
|
11
|
19
|
|
|
19
|
0
|
64
|
sub getters { +{} } |
12
|
0
|
|
|
0
|
0
|
0
|
sub setters { +{} } |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub keys { |
15
|
572
|
|
|
572
|
0
|
683
|
my $self = shift; |
16
|
572
|
|
|
|
|
604
|
return [keys %{$self->getters}]; |
|
572
|
|
|
|
|
896
|
|
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
140
|
0
|
|
sub default_getter {} |
20
|
|
|
|
193
|
0
|
|
sub default_setter {} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub TIEHASH { |
23
|
226
|
|
|
226
|
|
398
|
my $class = shift; |
24
|
226
|
|
|
|
|
694
|
return bless [@_], $class; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub FIRSTKEY { |
28
|
95
|
|
|
95
|
|
45735
|
my ($self) = @_; |
29
|
95
|
|
|
|
|
263
|
return $self->keys->[0]; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub NEXTKEY { |
33
|
411
|
|
|
411
|
|
721
|
my ($self, $last_key) = @_; |
34
|
411
|
|
|
|
|
451
|
my @keys = @{$self->keys}; |
|
411
|
|
|
|
|
547
|
|
35
|
411
|
|
|
|
|
1157
|
for (my $i = 0; $i < @keys; ++$i) { |
36
|
4073
|
100
|
|
|
|
8122
|
return $keys[$i + 1] if $keys[$i] eq $last_key; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub EXISTS { |
41
|
195
|
|
|
195
|
|
11720
|
my ($self, $key) = @_; |
42
|
195
|
|
|
|
|
229
|
return !!grep { $_ eq $key } @{$self->keys}; |
|
3251
|
|
|
|
|
4497
|
|
|
195
|
|
|
|
|
298
|
|
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub FETCH { |
46
|
3980
|
|
|
3980
|
|
71691
|
my ($self, $key) = @_; |
47
|
3980
|
100
|
|
|
|
7854
|
return $self->[0] if $key eq '__object'; |
48
|
3971
|
|
100
|
|
|
6789
|
my $getter = $self->getters->{$key} // $self->default_getter($key); |
49
|
3971
|
100
|
|
|
|
9451
|
return $getter->(@$self) if $getter; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub STORE { |
53
|
638
|
|
|
638
|
|
2000
|
my ($self, $key, $value) = @_; |
54
|
638
|
|
66
|
|
|
1268
|
my $setter = $self->setters->{$key} // $self->default_setter($key); |
55
|
638
|
|
|
|
|
946
|
local $_ = $value; |
56
|
638
|
100
|
|
|
|
1832
|
$setter->(@$self) if $setter; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |