line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Number::Phone::UK::DBM::Deep::Hash; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
48
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
6
|
use base 'Number::Phone::UK::DBM::Deep'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
771
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub _get_self { |
8
|
517
|
100
|
|
517
|
|
607
|
eval { local $SIG{'__DIE__'}; tied( %{$_[0]} ) } || $_[0] |
|
517
|
|
|
|
|
1658
|
|
|
517
|
|
|
|
|
546
|
|
|
517
|
|
|
|
|
3182
|
|
9
|
|
|
|
|
|
|
} |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub TIEHASH { |
12
|
|
|
|
|
|
|
## |
13
|
|
|
|
|
|
|
# Tied hash constructor method, called by Perl's tie() function. |
14
|
|
|
|
|
|
|
## |
15
|
12
|
|
|
12
|
|
18
|
my $class = shift; |
16
|
12
|
|
|
|
|
44
|
my $args = $class->_get_args( @_ ); |
17
|
|
|
|
|
|
|
|
18
|
12
|
|
|
|
|
65
|
$args->{type} = $class->TYPE_HASH; |
19
|
|
|
|
|
|
|
|
20
|
12
|
|
|
|
|
44
|
return $class->_init($args); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub FETCH { |
24
|
15
|
|
|
15
|
|
103
|
my $self = shift->_get_self; |
25
|
15
|
50
|
|
|
|
48
|
my $key = ($self->_root->{filter_store_key}) |
26
|
|
|
|
|
|
|
? $self->_root->{filter_store_key}->($_[0]) |
27
|
|
|
|
|
|
|
: $_[0]; |
28
|
|
|
|
|
|
|
|
29
|
15
|
|
|
|
|
61
|
return $self->SUPER::FETCH( $key ); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub STORE { |
33
|
0
|
|
|
0
|
|
0
|
my $self = shift->_get_self; |
34
|
0
|
0
|
|
|
|
0
|
my $key = ($self->_root->{filter_store_key}) |
35
|
|
|
|
|
|
|
? $self->_root->{filter_store_key}->($_[0]) |
36
|
|
|
|
|
|
|
: $_[0]; |
37
|
0
|
|
|
|
|
0
|
my $value = $_[1]; |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
0
|
return $self->SUPER::STORE( $key, $value ); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub EXISTS { |
43
|
5
|
|
|
5
|
|
15
|
my $self = shift->_get_self; |
44
|
5
|
50
|
|
|
|
18
|
my $key = ($self->_root->{filter_store_key}) |
45
|
|
|
|
|
|
|
? $self->_root->{filter_store_key}->($_[0]) |
46
|
|
|
|
|
|
|
: $_[0]; |
47
|
|
|
|
|
|
|
|
48
|
5
|
|
|
|
|
28
|
return $self->SUPER::EXISTS( $key ); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub DELETE { |
52
|
0
|
|
|
0
|
|
|
my $self = shift->_get_self; |
53
|
0
|
0
|
|
|
|
|
my $key = ($self->_root->{filter_store_key}) |
54
|
|
|
|
|
|
|
? $self->_root->{filter_store_key}->($_[0]) |
55
|
|
|
|
|
|
|
: $_[0]; |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
return $self->SUPER::DELETE( $key ); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub FIRSTKEY { |
61
|
|
|
|
|
|
|
## |
62
|
|
|
|
|
|
|
# Locate and return first key (in no particular order) |
63
|
|
|
|
|
|
|
## |
64
|
0
|
|
|
0
|
|
|
my $self = $_[0]->_get_self; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
## |
67
|
|
|
|
|
|
|
# Make sure file is open |
68
|
|
|
|
|
|
|
## |
69
|
0
|
0
|
|
|
|
|
if (!defined($self->_fh)) { $self->_open(); } |
|
0
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
## |
72
|
|
|
|
|
|
|
# Request shared lock for reading |
73
|
|
|
|
|
|
|
## |
74
|
0
|
|
|
|
|
|
$self->lock( $self->LOCK_SH ); |
75
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
my $result = $self->_get_next_key(); |
77
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
$self->unlock(); |
79
|
|
|
|
|
|
|
|
80
|
0
|
0
|
0
|
|
|
|
return ($result && $self->_root->{filter_fetch_key}) |
81
|
|
|
|
|
|
|
? $self->_root->{filter_fetch_key}->($result) |
82
|
|
|
|
|
|
|
: $result; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub NEXTKEY { |
86
|
|
|
|
|
|
|
## |
87
|
|
|
|
|
|
|
# Return next key (in no particular order), given previous one |
88
|
|
|
|
|
|
|
## |
89
|
0
|
|
|
0
|
|
|
my $self = $_[0]->_get_self; |
90
|
|
|
|
|
|
|
|
91
|
0
|
0
|
|
|
|
|
my $prev_key = ($self->_root->{filter_store_key}) |
92
|
|
|
|
|
|
|
? $self->_root->{filter_store_key}->($_[1]) |
93
|
|
|
|
|
|
|
: $_[1]; |
94
|
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
my $prev_md5 = $Number::Phone::UK::DBM::Deep::DIGEST_FUNC->($prev_key); |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
## |
98
|
|
|
|
|
|
|
# Make sure file is open |
99
|
|
|
|
|
|
|
## |
100
|
0
|
0
|
|
|
|
|
if (!defined($self->_fh)) { $self->_open(); } |
|
0
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
## |
103
|
|
|
|
|
|
|
# Request shared lock for reading |
104
|
|
|
|
|
|
|
## |
105
|
0
|
|
|
|
|
|
$self->lock( $self->LOCK_SH ); |
106
|
|
|
|
|
|
|
|
107
|
0
|
|
|
|
|
|
my $result = $self->_get_next_key( $prev_md5 ); |
108
|
|
|
|
|
|
|
|
109
|
0
|
|
|
|
|
|
$self->unlock(); |
110
|
|
|
|
|
|
|
|
111
|
0
|
0
|
0
|
|
|
|
return ($result && $self->_root->{filter_fetch_key}) |
112
|
|
|
|
|
|
|
? $self->_root->{filter_fetch_key}->($result) |
113
|
|
|
|
|
|
|
: $result; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
## |
117
|
|
|
|
|
|
|
# Public method aliases |
118
|
|
|
|
|
|
|
## |
119
|
|
|
|
|
|
|
*first_key = *FIRSTKEY; |
120
|
|
|
|
|
|
|
*next_key = *NEXTKEY; |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
1; |
123
|
|
|
|
|
|
|
__END__ |