line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
41
|
|
|
41
|
|
278
|
use strict; |
|
41
|
|
|
|
|
80
|
|
|
41
|
|
|
|
|
1138
|
|
2
|
41
|
|
|
41
|
|
215
|
use warnings; |
|
41
|
|
|
|
|
77
|
|
|
41
|
|
|
|
|
1811
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Test::Deep::Cache::Simple 1.203; |
5
|
|
|
|
|
|
|
|
6
|
41
|
|
|
41
|
|
227
|
use Carp qw( confess ); |
|
41
|
|
|
|
|
139
|
|
|
41
|
|
|
|
|
2209
|
|
7
|
|
|
|
|
|
|
|
8
|
41
|
|
|
41
|
|
283
|
use Scalar::Util qw( refaddr ); |
|
41
|
|
|
|
|
107
|
|
|
41
|
|
|
|
|
5266
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
BEGIN |
11
|
|
|
|
|
|
|
{ |
12
|
41
|
50
|
|
41
|
|
312
|
if (grep /^weaken$/, @Scalar::Util::EXPORT_FAIL) |
13
|
|
|
|
|
|
|
{ |
14
|
|
|
|
|
|
|
# we're running on a version of perl that has no weak refs, so we |
15
|
|
|
|
|
|
|
# just install a no-op sub for weaken instead of importing it |
16
|
0
|
|
|
|
|
0
|
*weaken = sub {}; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
else |
19
|
|
|
|
|
|
|
{ |
20
|
41
|
|
|
|
|
15224
|
Scalar::Util->import('weaken'); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub new |
25
|
|
|
|
|
|
|
{ |
26
|
2690
|
|
|
2690
|
0
|
3863
|
my $pkg = shift; |
27
|
|
|
|
|
|
|
|
28
|
2690
|
|
|
|
|
4140
|
my $self = bless {}, $pkg; |
29
|
|
|
|
|
|
|
|
30
|
2690
|
|
|
|
|
6472
|
return $self; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub add |
34
|
|
|
|
|
|
|
{ |
35
|
1138
|
|
|
1138
|
0
|
1738
|
my $self = shift; |
36
|
|
|
|
|
|
|
|
37
|
1138
|
|
|
|
|
1995
|
my ($d1, $d2) = @_; |
38
|
|
|
|
|
|
|
{ |
39
|
1138
|
|
|
|
|
1502
|
local $SIG{__DIE__}; |
|
1138
|
|
|
|
|
3341
|
|
40
|
|
|
|
|
|
|
|
41
|
1138
|
|
|
|
|
1702
|
local $@; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# cannot weaken read only refs, no harm if we can't as they never |
44
|
|
|
|
|
|
|
# disappear |
45
|
1138
|
|
|
|
|
1932
|
eval{weaken($d1)}; |
|
1138
|
|
|
|
|
2525
|
|
46
|
1138
|
|
|
|
|
1472
|
eval{weaken($d2)}; |
|
1138
|
|
|
|
|
4633
|
|
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
1138
|
|
|
|
|
3050
|
$self->{fn_get_key(@_)} = [$d1, $d2]; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub cmp |
53
|
|
|
|
|
|
|
{ |
54
|
2509
|
|
|
2509
|
0
|
3618
|
my $self = shift; |
55
|
|
|
|
|
|
|
|
56
|
2509
|
|
|
|
|
4103
|
my $key = fn_get_key(@_); |
57
|
2509
|
|
|
|
|
5236
|
my $pair = $self->{$key}; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# are both weakened refs still valid, if not delete this entry |
60
|
2509
|
100
|
66
|
|
|
6118
|
if (ref($pair->[0]) and ref($pair->[1])) |
61
|
|
|
|
|
|
|
{ |
62
|
40
|
|
|
|
|
203
|
return 1; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
else |
65
|
|
|
|
|
|
|
{ |
66
|
2469
|
|
|
|
|
3553
|
delete $self->{$key}; |
67
|
2469
|
|
|
|
|
7101
|
return 0; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub absorb |
72
|
|
|
|
|
|
|
{ |
73
|
304
|
|
|
304
|
0
|
451
|
my $self = shift; |
74
|
|
|
|
|
|
|
|
75
|
304
|
|
|
|
|
391
|
my $other = shift; |
76
|
|
|
|
|
|
|
|
77
|
304
|
|
|
|
|
601
|
@{$self}{keys %$other} = values %$other; |
|
304
|
|
|
|
|
892
|
|
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub fn_get_key |
81
|
|
|
|
|
|
|
{ |
82
|
3647
|
|
|
3647
|
0
|
5802
|
return join(",", sort (map {refaddr($_)} @_)); |
|
7294
|
|
|
|
|
22010
|
|
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
1; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
__END__ |