line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package IPC::Shm::Tied::HASH; |
2
|
6
|
|
|
6
|
|
28
|
use warnings; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
321
|
|
3
|
6
|
|
|
6
|
|
31
|
use strict; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
153
|
|
4
|
6
|
|
|
6
|
|
28
|
use Carp; |
|
6
|
|
|
|
|
29
|
|
|
6
|
|
|
|
|
450
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# |
7
|
|
|
|
|
|
|
# Copyright (c) 2014 by Kevin Cody-Little |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
# This code may be modified or redistributed under the terms |
10
|
|
|
|
|
|
|
# of either the Artistic or GNU General Public licenses, at |
11
|
|
|
|
|
|
|
# the modifier or redistributor's discretion. |
12
|
|
|
|
|
|
|
# |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 NAME |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
IPC::Shm::Tied::HASH |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 SYNOPSIS |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
This class is part of the IPC::Shm implementation. You should not be using it directly. |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=cut |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# Loaded from IPC::Shm::Tied, so don't reload it |
25
|
6
|
|
|
6
|
|
30
|
use vars qw( @ISA ); |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
329
|
|
26
|
|
|
|
|
|
|
@ISA = qw( IPC::Shm::Tied ); |
27
|
|
|
|
|
|
|
|
28
|
6
|
|
|
6
|
|
4901
|
use IPC::Shm::Make; |
|
6
|
|
|
|
|
29
|
|
|
6
|
|
|
|
|
12369
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub EMPTY { |
32
|
19
|
|
|
19
|
1
|
80
|
return {}; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub TIEHASH { |
36
|
24
|
|
|
24
|
|
38
|
my ( $class, $this ) = @_; |
37
|
|
|
|
|
|
|
|
38
|
24
|
|
|
|
|
124
|
return bless $this, $class; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub FETCH { |
42
|
76
|
|
|
76
|
|
1283
|
my ( $this, $key ) = @_; |
43
|
|
|
|
|
|
|
|
44
|
76
|
|
|
|
|
261
|
my $locked = $this->readlock; |
45
|
76
|
|
|
|
|
1391
|
$this->fetch; |
46
|
76
|
50
|
|
|
|
9404
|
$this->unlock if $locked; |
47
|
|
|
|
|
|
|
|
48
|
76
|
|
|
|
|
1027
|
my $rv = $this->vcache->{$key}; |
49
|
|
|
|
|
|
|
|
50
|
76
|
100
|
|
|
|
393
|
return ref( $rv ) ? getback( $rv ) : $rv; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub STORE { |
54
|
29
|
|
|
29
|
|
186
|
my ( $this, $key, $value ) = @_; |
55
|
|
|
|
|
|
|
|
56
|
29
|
|
|
|
|
96
|
makeshm( \$value ); |
57
|
|
|
|
|
|
|
|
58
|
29
|
|
|
|
|
136
|
my $locked = $this->writelock; |
59
|
|
|
|
|
|
|
|
60
|
29
|
|
|
|
|
458
|
$this->fetch; |
61
|
29
|
|
|
|
|
5580
|
my $vcache = $this->vcache; |
62
|
29
|
|
|
|
|
53
|
my $oldval = $vcache->{$key}; |
63
|
|
|
|
|
|
|
|
64
|
29
|
|
|
|
|
70
|
$vcache->{$key} = $value; |
65
|
29
|
|
|
|
|
103
|
$this->flush; |
66
|
|
|
|
|
|
|
|
67
|
29
|
100
|
|
|
|
6985
|
$this->unlock if $locked; |
68
|
|
|
|
|
|
|
|
69
|
29
|
50
|
66
|
|
|
406
|
$this->standin_discard( $oldval ) if ( $oldval and ref( $oldval ) ); |
70
|
|
|
|
|
|
|
|
71
|
29
|
|
|
|
|
110
|
return $value; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub DELETE { |
75
|
13
|
|
|
13
|
|
27
|
my ( $this, $key ) = @_; |
76
|
|
|
|
|
|
|
|
77
|
13
|
|
|
|
|
51
|
my $locked = $this->writelock; |
78
|
|
|
|
|
|
|
|
79
|
13
|
|
|
|
|
232
|
$this->fetch; |
80
|
13
|
|
|
|
|
1777
|
my $vcache = $this->vcache; |
81
|
13
|
|
|
|
|
34
|
my $oldval = $vcache->{$key}; |
82
|
|
|
|
|
|
|
|
83
|
13
|
|
|
|
|
33
|
delete $vcache->{$key}; |
84
|
13
|
|
|
|
|
49
|
$this->flush; |
85
|
|
|
|
|
|
|
|
86
|
13
|
50
|
|
|
|
2625
|
$this->unlock if $locked; |
87
|
|
|
|
|
|
|
|
88
|
13
|
50
|
33
|
|
|
224
|
$this->standin_discard( $oldval ) if ( $oldval and ref( $oldval ) ); |
89
|
|
|
|
|
|
|
|
90
|
13
|
|
|
|
|
62
|
return 1; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub CLEAR { |
94
|
9
|
|
|
9
|
|
57
|
my ( $this ) = @_; |
95
|
|
|
|
|
|
|
|
96
|
9
|
|
|
|
|
29
|
my $locked = $this->writelock; |
97
|
|
|
|
|
|
|
|
98
|
9
|
|
|
|
|
96
|
$this->fetch; |
99
|
9
|
|
|
|
|
603
|
my $vcache = $this->vcache; |
100
|
|
|
|
|
|
|
|
101
|
9
|
|
|
|
|
28
|
$this->vcache( $this->EMPTY ); |
102
|
9
|
|
|
|
|
29
|
$this->flush; |
103
|
|
|
|
|
|
|
|
104
|
9
|
100
|
|
|
|
1510
|
$this->unlock if $locked; |
105
|
|
|
|
|
|
|
|
106
|
9
|
|
|
|
|
47
|
foreach my $oldval ( values %{$vcache} ) { |
|
9
|
|
|
|
|
33
|
|
107
|
8
|
100
|
66
|
|
|
73
|
$this->standin_discard( $oldval ) if ( $oldval and ref( $oldval ) ); |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
9
|
|
|
|
|
59
|
return 1; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub EXISTS { |
114
|
0
|
|
|
0
|
|
0
|
my ( $this, $key ) = @_; |
115
|
|
|
|
|
|
|
|
116
|
0
|
|
|
|
|
0
|
my $locked = $this->readlock; |
117
|
0
|
|
|
|
|
0
|
$this->fetch; |
118
|
0
|
0
|
|
|
|
0
|
$this->unlock if $locked; |
119
|
|
|
|
|
|
|
|
120
|
0
|
|
|
|
|
0
|
return exists $this->vcache->{$key}; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub FIRSTKEY { |
124
|
4
|
|
|
4
|
|
9
|
my ( $this ) = @_; |
125
|
|
|
|
|
|
|
|
126
|
4
|
|
|
|
|
23
|
my $locked = $this->readlock; |
127
|
4
|
|
|
|
|
102
|
$this->fetch; |
128
|
4
|
50
|
|
|
|
727
|
$this->unlock if $locked; |
129
|
|
|
|
|
|
|
|
130
|
4
|
|
|
|
|
91
|
my ( %index, $first, $last ); |
131
|
4
|
|
|
|
|
8
|
foreach my $key ( keys %{$this->vcache} ) { |
|
4
|
|
|
|
|
12
|
|
132
|
|
|
|
|
|
|
|
133
|
9
|
100
|
|
|
|
23
|
unless ( defined $first ) { |
134
|
3
|
|
|
|
|
6
|
$first = $last = $key; |
135
|
3
|
|
|
|
|
6
|
next; |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
|
138
|
6
|
|
|
|
|
13
|
$index{$last} = $key; |
139
|
6
|
|
|
|
|
12
|
$last = $key; |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
|
143
|
4
|
100
|
|
|
|
16
|
return unless defined $first; |
144
|
|
|
|
|
|
|
|
145
|
3
|
50
|
|
|
|
10
|
$index{$last} = undef if $last; |
146
|
|
|
|
|
|
|
|
147
|
3
|
|
|
|
|
9
|
$this->{icache} = \%index; |
148
|
|
|
|
|
|
|
|
149
|
3
|
|
|
|
|
15
|
return $first; |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
sub NEXTKEY { |
153
|
9
|
|
|
9
|
|
13
|
my ( $this, $lastkey ) = @_; |
154
|
|
|
|
|
|
|
|
155
|
9
|
|
|
|
|
14
|
my $icache = $this->{icache}; |
156
|
|
|
|
|
|
|
|
157
|
9
|
100
|
|
|
|
25
|
return unless defined $icache->{$lastkey}; |
158
|
|
|
|
|
|
|
|
159
|
6
|
|
|
|
|
19
|
return $icache->{$lastkey}; |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
sub SCALAR { |
163
|
0
|
|
|
0
|
|
|
my ( $this ) = @_; |
164
|
|
|
|
|
|
|
|
165
|
0
|
|
|
|
|
|
my $locked = $this->readlock; |
166
|
0
|
|
|
|
|
|
$this->fetch; |
167
|
0
|
0
|
|
|
|
|
$this->unlock if $locked; |
168
|
|
|
|
|
|
|
|
169
|
0
|
|
|
|
|
|
return scalar %{$this->vcache}; |
|
0
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
} |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=head1 AUTHOR |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
Kevin Cody-Little |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=cut |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
1; |