line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::WeakMap::Tie; |
2
|
1
|
|
|
1
|
|
19
|
use 5.014; |
|
1
|
|
|
|
|
4
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings FATAL => 'all'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
52
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
7
|
use Scalar::Util 'weaken'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
53
|
|
6
|
1
|
|
|
1
|
|
5
|
use Carp 'croak'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
795
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = "v0.0.3"; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub TIEHASH { |
11
|
9
|
|
|
9
|
|
19
|
my ($class, $mbp) = @_; |
12
|
|
|
|
|
|
|
|
13
|
9
|
|
|
|
|
18
|
my $self = [$mbp]; |
14
|
9
|
|
|
|
|
35
|
weaken($self->[0]); |
15
|
|
|
|
|
|
|
|
16
|
9
|
|
|
|
|
31
|
bless $self, $class; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub STORE { |
20
|
231
|
|
|
231
|
|
400
|
my ($self, $key, $value) = @_; |
21
|
|
|
|
|
|
|
|
22
|
231
|
50
|
|
|
|
465
|
croak 'key argument is not a ref' if ref $key eq ''; |
23
|
|
|
|
|
|
|
|
24
|
231
|
|
|
|
|
287
|
my $struct = ${ $_[0][0] }; |
|
231
|
|
|
|
|
417
|
|
25
|
|
|
|
|
|
|
|
26
|
231
|
|
|
|
|
853
|
weaken($struct->{tied_keys}{$key} = $key); |
27
|
231
|
|
|
|
|
427
|
$struct->{values}{$key} = $value; |
28
|
|
|
|
|
|
|
|
29
|
231
|
|
|
|
|
1230
|
require Data::WeakMap::Key::Tie; |
30
|
231
|
|
|
|
|
689
|
tie $struct->{tied_keys}{$key}, 'Data::WeakMap::Key::Tie', $struct->{dummy}, $key; |
31
|
|
|
|
|
|
|
|
32
|
231
|
|
|
|
|
655
|
return $self; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub FETCH { |
36
|
11
|
|
|
11
|
|
2874
|
my ($self, $key) = @_; |
37
|
|
|
|
|
|
|
|
38
|
11
|
50
|
|
|
|
30
|
croak 'key argument is not a ref' if ref $key eq ''; |
39
|
|
|
|
|
|
|
|
40
|
11
|
|
|
|
|
16
|
my $struct = ${ $_[0][0] }; |
|
11
|
|
|
|
|
20
|
|
41
|
|
|
|
|
|
|
|
42
|
11
|
|
|
|
|
48
|
return $struct->{values}{$key}; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub DELETE { |
46
|
226
|
|
|
226
|
|
358
|
my ($self, $key) = @_; |
47
|
|
|
|
|
|
|
|
48
|
226
|
50
|
66
|
|
|
759
|
croak 'key argument is not a ref' if ref $key eq '' and caller ne 'Data::WeakMap::Key::Tie'; |
49
|
|
|
|
|
|
|
|
50
|
226
|
|
|
|
|
300
|
my $struct = ${ $_[0][0] }; |
|
226
|
|
|
|
|
392
|
|
51
|
|
|
|
|
|
|
|
52
|
226
|
|
|
|
|
385
|
my $ret = delete $struct->{values}{$key}; |
53
|
226
|
|
|
|
|
369
|
delete $struct->{tied_keys}{$key}; |
54
|
|
|
|
|
|
|
|
55
|
226
|
|
|
|
|
831
|
return $ret; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub CLEAR { |
59
|
2
|
|
|
2
|
|
5
|
my ($self) = @_; |
60
|
|
|
|
|
|
|
|
61
|
2
|
|
|
|
|
3
|
my $struct = ${ $_[0][0] }; |
|
2
|
|
|
|
|
6
|
|
62
|
|
|
|
|
|
|
|
63
|
2
|
|
|
|
|
6
|
%{ $struct->{$_} } = () foreach qw/ tied_keys values /; |
|
4
|
|
|
|
|
23
|
|
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub EXISTS { |
67
|
2
|
|
|
2
|
|
5
|
my ($self, $key) = @_; |
68
|
|
|
|
|
|
|
|
69
|
2
|
50
|
|
|
|
8
|
croak 'key argument is not a ref' if ref $key eq ''; |
70
|
|
|
|
|
|
|
|
71
|
2
|
|
|
|
|
5
|
my $struct = ${ $_[0][0] }; |
|
2
|
|
|
|
|
4
|
|
72
|
|
|
|
|
|
|
|
73
|
2
|
|
|
|
|
12
|
return exists $struct->{tied_keys}{$key}; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub FIRSTKEY { |
77
|
20
|
|
|
20
|
|
232
|
my ($self) = @_; |
78
|
|
|
|
|
|
|
|
79
|
20
|
|
|
|
|
26
|
my $struct = ${ $_[0][0] }; |
|
20
|
|
|
|
|
39
|
|
80
|
|
|
|
|
|
|
|
81
|
20
|
|
|
|
|
31
|
my $z = keys %{ $struct->{tied_keys} }; |
|
20
|
|
|
|
|
48
|
|
82
|
|
|
|
|
|
|
|
83
|
20
|
|
|
|
|
32
|
return (each %{ $struct->{tied_keys} })[1]; |
|
20
|
|
|
|
|
77
|
|
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub NEXTKEY { |
87
|
338
|
|
|
338
|
|
520
|
my ($self, $lastkey) = @_; |
88
|
|
|
|
|
|
|
|
89
|
338
|
|
|
|
|
397
|
my $struct = ${ $_[0][0] }; |
|
338
|
|
|
|
|
535
|
|
90
|
|
|
|
|
|
|
|
91
|
338
|
|
|
|
|
838
|
weaken($struct->{tied_keys}{$lastkey}); |
92
|
|
|
|
|
|
|
|
93
|
338
|
|
|
|
|
419
|
return (each %{ $struct->{tied_keys} })[1]; |
|
338
|
|
|
|
|
806
|
|
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub SCALAR { |
97
|
3
|
|
|
3
|
|
7
|
my ($self) = @_; |
98
|
|
|
|
|
|
|
|
99
|
3
|
|
|
|
|
4
|
my $struct = ${ $_[0][0] }; |
|
3
|
|
|
|
|
7
|
|
100
|
|
|
|
|
|
|
|
101
|
3
|
|
|
|
|
6
|
return scalar %{ $struct->{tied_keys} }; |
|
3
|
|
|
|
|
19
|
|
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
1; |