line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::WeakMap::Item::Tie; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use Scalar::Util 'weaken'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
280
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub TIESCALAR { |
9
|
113
|
|
|
113
|
|
556
|
my ($class, $ref_c, $hash, $value) = @_; |
10
|
|
|
|
|
|
|
|
11
|
113
|
|
|
|
|
359
|
my $thing = { |
12
|
|
|
|
|
|
|
ref_c => $ref_c, |
13
|
|
|
|
|
|
|
key => "$$ref_c", |
14
|
|
|
|
|
|
|
value => $value, |
15
|
|
|
|
|
|
|
}; |
16
|
113
|
|
|
|
|
333
|
weaken($thing->{hash} = $hash); |
17
|
|
|
|
|
|
|
|
18
|
113
|
|
|
|
|
338
|
bless $thing, $class; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub STORE { |
22
|
113
|
|
|
113
|
|
5209
|
my ($self, $value) = @_; |
23
|
|
|
|
|
|
|
|
24
|
113
|
|
50
|
|
|
204
|
my $hash = $self->{hash} // return; # is 'return' needed? the test still fails sometimes |
25
|
113
|
|
|
|
|
313
|
delete $hash->{ $self->{key} }; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub FETCH { |
29
|
321
|
|
|
321
|
|
470
|
my ($self) = @_; |
30
|
|
|
|
|
|
|
|
31
|
321
|
|
|
|
|
386
|
return ${ $self->{ref_c} }; |
|
321
|
|
|
|
|
1008
|
|
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub DESTROY { |
35
|
|
|
|
|
|
|
# avoid random error of type: "Can't call method "STORE" on an undefined value during global destruction." |
36
|
0
|
0
|
|
0
|
|
|
if (${^GLOBAL_PHASE} eq 'DESTRUCT') { |
37
|
0
|
|
|
|
|
|
untie ${ shift()->{ref_c} }; |
|
0
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |