line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
6
|
#line 1 |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
34
|
|
2
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
40
|
|
3
|
|
|
|
|
|
|
use warnings; |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
7
|
package Test::Deep::Cache::Simple; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
61
|
|
6
|
|
|
|
|
|
|
use Carp qw( confess ); |
7
|
1
|
|
|
1
|
|
7
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
209
|
|
8
|
|
|
|
|
|
|
use Scalar::Util qw( refaddr ); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
BEGIN |
11
|
1
|
50
|
|
1
|
|
6
|
{ |
12
|
|
|
|
|
|
|
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
|
0
|
|
|
|
|
0
|
# just install a no-op sub for weaken instead of importing it |
|
0
|
|
|
|
|
0
|
|
16
|
|
|
|
|
|
|
*weaken = sub {}; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
else |
19
|
1
|
|
|
|
|
423
|
{ |
20
|
|
|
|
|
|
|
Scalar::Util->import('weaken'); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub new |
25
|
24
|
|
|
24
|
0
|
33
|
{ |
26
|
|
|
|
|
|
|
my $pkg = shift; |
27
|
24
|
|
|
|
|
61
|
|
28
|
|
|
|
|
|
|
my $self = bless {}, $pkg; |
29
|
24
|
|
|
|
|
90
|
|
30
|
|
|
|
|
|
|
return $self; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub add |
34
|
36
|
|
|
36
|
0
|
87
|
{ |
35
|
|
|
|
|
|
|
my $self = shift; |
36
|
36
|
|
|
|
|
259
|
|
37
|
|
|
|
|
|
|
my ($d1, $d2) = @_; |
38
|
36
|
|
|
|
|
106
|
{ |
|
36
|
|
|
|
|
376
|
|
39
|
|
|
|
|
|
|
local $SIG{__DIE__}; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# cannot weaken read only refs, no harm if we can't as they never |
42
|
36
|
|
|
|
|
49
|
# disappear |
|
36
|
|
|
|
|
88
|
|
43
|
36
|
|
|
|
|
39
|
eval{weaken($d1)}; |
|
36
|
|
|
|
|
142
|
|
44
|
|
|
|
|
|
|
eval{weaken($d2)}; |
45
|
|
|
|
|
|
|
} |
46
|
36
|
|
|
|
|
106
|
|
47
|
|
|
|
|
|
|
$self->{fn_get_key(@_)} = [$d1, $d2]; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub cmp |
51
|
72
|
|
|
72
|
0
|
89
|
{ |
52
|
|
|
|
|
|
|
my $self = shift; |
53
|
72
|
|
|
|
|
155
|
|
54
|
72
|
|
|
|
|
470
|
my $key = fn_get_key(@_); |
55
|
|
|
|
|
|
|
my $pair = $self->{$key}; |
56
|
|
|
|
|
|
|
|
57
|
72
|
50
|
33
|
|
|
234
|
# are both weakened refs still valid, if not delete this entry |
58
|
|
|
|
|
|
|
if (ref($pair->[0]) and ref($pair->[1])) |
59
|
0
|
|
|
|
|
0
|
{ |
60
|
|
|
|
|
|
|
return 1; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
else |
63
|
72
|
|
|
|
|
113
|
{ |
64
|
72
|
|
|
|
|
336
|
delete $self->{$key}; |
65
|
|
|
|
|
|
|
return 0; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub absorb |
70
|
0
|
|
|
0
|
0
|
0
|
{ |
71
|
|
|
|
|
|
|
my $self = shift; |
72
|
0
|
|
|
|
|
0
|
|
73
|
|
|
|
|
|
|
my $other = shift; |
74
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
75
|
|
|
|
|
|
|
@{$self}{keys %$other} = values %$other; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub fn_get_key |
79
|
108
|
|
|
108
|
0
|
200
|
{ |
|
216
|
|
|
|
|
1067
|
|
80
|
|
|
|
|
|
|
return join(",", sort (map {refaddr($_)} @_)); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
1; |