line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
13
|
|
|
13
|
|
69
|
#line 1 |
|
13
|
|
|
|
|
24
|
|
|
13
|
|
|
|
|
400
|
|
2
|
13
|
|
|
13
|
|
65
|
use strict; |
|
13
|
|
|
|
|
25
|
|
|
13
|
|
|
|
|
482
|
|
3
|
|
|
|
|
|
|
use warnings; |
4
|
|
|
|
|
|
|
|
5
|
13
|
|
|
13
|
|
63
|
package Test::Deep::Cache::Simple; |
|
13
|
|
|
|
|
23
|
|
|
13
|
|
|
|
|
768
|
|
6
|
|
|
|
|
|
|
use Carp qw( confess ); |
7
|
13
|
|
|
13
|
|
69
|
|
|
13
|
|
|
|
|
132
|
|
|
13
|
|
|
|
|
3042
|
|
8
|
|
|
|
|
|
|
use Scalar::Util qw( refaddr ); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
BEGIN |
11
|
13
|
50
|
|
13
|
|
63
|
{ |
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
|
13
|
|
|
|
|
5125
|
{ |
20
|
|
|
|
|
|
|
Scalar::Util->import('weaken'); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub new |
25
|
284
|
|
|
284
|
0
|
399
|
{ |
26
|
|
|
|
|
|
|
my $pkg = shift; |
27
|
284
|
|
|
|
|
734
|
|
28
|
|
|
|
|
|
|
my $self = bless {}, $pkg; |
29
|
284
|
|
|
|
|
1165
|
|
30
|
|
|
|
|
|
|
return $self; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub add |
34
|
426
|
|
|
426
|
0
|
526
|
{ |
35
|
|
|
|
|
|
|
my $self = shift; |
36
|
426
|
|
|
|
|
619
|
|
37
|
|
|
|
|
|
|
my ($d1, $d2) = @_; |
38
|
426
|
|
|
|
|
460
|
{ |
|
426
|
|
|
|
|
1432
|
|
39
|
|
|
|
|
|
|
local $SIG{__DIE__}; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# cannot weaken read only refs, no harm if we can't as they never |
42
|
426
|
|
|
|
|
557
|
# disappear |
|
426
|
|
|
|
|
1002
|
|
43
|
426
|
|
|
|
|
458
|
eval{weaken($d1)}; |
|
426
|
|
|
|
|
2077
|
|
44
|
|
|
|
|
|
|
eval{weaken($d2)}; |
45
|
|
|
|
|
|
|
} |
46
|
426
|
|
|
|
|
1186
|
|
47
|
|
|
|
|
|
|
$self->{fn_get_key(@_)} = [$d1, $d2]; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub cmp |
51
|
852
|
|
|
852
|
0
|
1493
|
{ |
52
|
|
|
|
|
|
|
my $self = shift; |
53
|
852
|
|
|
|
|
1458
|
|
54
|
852
|
|
|
|
|
1755
|
my $key = fn_get_key(@_); |
55
|
|
|
|
|
|
|
my $pair = $self->{$key}; |
56
|
|
|
|
|
|
|
|
57
|
852
|
50
|
33
|
|
|
2702
|
# 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
|
852
|
|
|
|
|
1138
|
{ |
64
|
852
|
|
|
|
|
4883
|
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
|
1278
|
|
|
1278
|
0
|
1989
|
{ |
|
2556
|
|
|
|
|
14388
|
|
80
|
|
|
|
|
|
|
return join(",", sort (map {refaddr($_)} @_)); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
1; |