line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
16
|
|
|
16
|
|
75
|
#line 1 |
|
16
|
|
|
|
|
28
|
|
|
16
|
|
|
|
|
442
|
|
2
|
16
|
|
|
16
|
|
74
|
use strict; |
|
16
|
|
|
|
|
29
|
|
|
16
|
|
|
|
|
607
|
|
3
|
|
|
|
|
|
|
use warnings; |
4
|
|
|
|
|
|
|
|
5
|
16
|
|
|
16
|
|
73
|
package Test::Deep::Cache::Simple; |
|
16
|
|
|
|
|
25
|
|
|
16
|
|
|
|
|
673
|
|
6
|
|
|
|
|
|
|
use Carp qw( confess ); |
7
|
16
|
|
|
16
|
|
82
|
|
|
16
|
|
|
|
|
25
|
|
|
16
|
|
|
|
|
2924
|
|
8
|
|
|
|
|
|
|
use Scalar::Util qw( refaddr ); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
BEGIN |
11
|
16
|
50
|
|
16
|
|
81
|
{ |
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
|
16
|
|
|
|
|
5545
|
{ |
20
|
|
|
|
|
|
|
Scalar::Util->import('weaken'); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub new |
25
|
268
|
|
|
268
|
0
|
358
|
{ |
26
|
|
|
|
|
|
|
my $pkg = shift; |
27
|
268
|
|
|
|
|
680
|
|
28
|
|
|
|
|
|
|
my $self = bless {}, $pkg; |
29
|
268
|
|
|
|
|
1234
|
|
30
|
|
|
|
|
|
|
return $self; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub add |
34
|
402
|
|
|
402
|
0
|
623
|
{ |
35
|
|
|
|
|
|
|
my $self = shift; |
36
|
402
|
|
|
|
|
564
|
|
37
|
|
|
|
|
|
|
my ($d1, $d2) = @_; |
38
|
402
|
|
|
|
|
1145
|
{ |
|
402
|
|
|
|
|
1477
|
|
39
|
|
|
|
|
|
|
local $SIG{__DIE__}; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# cannot weaken read only refs, no harm if we can't as they never |
42
|
402
|
|
|
|
|
535
|
# disappear |
|
402
|
|
|
|
|
840
|
|
43
|
402
|
|
|
|
|
688
|
eval{weaken($d1)}; |
|
402
|
|
|
|
|
2112
|
|
44
|
|
|
|
|
|
|
eval{weaken($d2)}; |
45
|
|
|
|
|
|
|
} |
46
|
402
|
|
|
|
|
1224
|
|
47
|
|
|
|
|
|
|
$self->{fn_get_key(@_)} = [$d1, $d2]; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub cmp |
51
|
804
|
|
|
804
|
0
|
952
|
{ |
52
|
|
|
|
|
|
|
my $self = shift; |
53
|
804
|
|
|
|
|
1399
|
|
54
|
804
|
|
|
|
|
1602
|
my $key = fn_get_key(@_); |
55
|
|
|
|
|
|
|
my $pair = $self->{$key}; |
56
|
|
|
|
|
|
|
|
57
|
804
|
50
|
33
|
|
|
2303
|
# 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
|
804
|
|
|
|
|
1144
|
{ |
64
|
804
|
|
|
|
|
3298
|
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
|
1206
|
|
|
1206
|
0
|
1764
|
{ |
|
2412
|
|
|
|
|
13157
|
|
80
|
|
|
|
|
|
|
return join(",", sort (map {refaddr($_)} @_)); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
1; |