line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Autocache::Record; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
111
|
use strict; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
191
|
|
4
|
5
|
|
|
5
|
|
27
|
use warnings; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
158
|
|
5
|
|
|
|
|
|
|
|
6
|
5
|
|
|
5
|
|
27
|
use Autocache::Logger qw(get_logger); |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
2348
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $AUTOLOAD; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new |
11
|
|
|
|
|
|
|
{ |
12
|
67
|
|
|
67
|
0
|
218
|
my ($class,%args) = @_; |
13
|
67
|
|
|
|
|
90
|
my $now = time; |
14
|
67
|
50
|
|
|
|
155
|
$args{name} = 'unknown' |
15
|
|
|
|
|
|
|
unless defined $args{name}; |
16
|
67
|
50
|
|
|
|
166
|
$args{create_time} = $now |
17
|
|
|
|
|
|
|
unless defined $args{create_time}; |
18
|
67
|
|
|
|
|
248
|
my $self = { %args }; |
19
|
67
|
|
|
|
|
353
|
return bless $self, $class; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub name |
23
|
|
|
|
|
|
|
{ |
24
|
0
|
|
|
0
|
0
|
0
|
$_[0]->{name}; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub create_time |
28
|
|
|
|
|
|
|
{ |
29
|
0
|
|
|
0
|
0
|
0
|
$_[0]->{create_time}; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub age |
33
|
|
|
|
|
|
|
{ |
34
|
0
|
|
|
0
|
0
|
0
|
time - $_[0]->create_time; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub to_string |
38
|
|
|
|
|
|
|
{ |
39
|
0
|
|
|
0
|
0
|
0
|
my ($self) = @_; |
40
|
0
|
|
|
|
|
0
|
return sprintf 'name: %s - key: %s - create_time: %d - age: %d', |
41
|
|
|
|
|
|
|
$self->name, |
42
|
|
|
|
|
|
|
$self->key, |
43
|
|
|
|
|
|
|
$self->create_time, |
44
|
|
|
|
|
|
|
$self->age; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub AUTOLOAD |
48
|
|
|
|
|
|
|
{ |
49
|
2
|
|
|
2
|
|
6
|
my ($self) = @_; |
50
|
2
|
50
|
|
|
|
13
|
return if $AUTOLOAD =~ /::DESTROY$/; |
51
|
2
|
|
|
|
|
8
|
get_logger()->debug( "AUTOLOAD $AUTOLOAD" ); |
52
|
2
|
50
|
|
|
|
88
|
if( $AUTOLOAD =~ m/^.*::(\w+?)$/ ) |
53
|
|
|
|
|
|
|
{ |
54
|
2
|
|
|
|
|
12
|
my $name = $1; |
55
|
|
|
|
|
|
|
{ |
56
|
5
|
|
|
5
|
|
31
|
no strict 'refs'; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
897
|
|
|
2
|
|
|
|
|
3
|
|
57
|
2
|
|
|
|
|
12
|
*{$AUTOLOAD} = sub |
58
|
|
|
|
|
|
|
{ |
59
|
129
|
50
|
|
129
|
|
254
|
if( scalar @_ > 1 ) |
60
|
|
|
|
|
|
|
{ |
61
|
0
|
|
|
|
|
0
|
$_[0]->{$name} = $_[1]; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
else |
64
|
|
|
|
|
|
|
{ |
65
|
129
|
|
|
|
|
363
|
return $_[0]->{$name}; |
66
|
|
|
|
|
|
|
} |
67
|
2
|
|
|
|
|
14
|
}; |
68
|
|
|
|
|
|
|
} |
69
|
2
|
|
|
|
|
6
|
goto &{$AUTOLOAD}; |
|
2
|
|
|
|
|
13
|
|
70
|
|
|
|
|
|
|
} |
71
|
0
|
|
|
|
|
|
get_logger()->error( "AUTOLOAD failed : $AUTOLOAD" ); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
1; |