line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mail::Action::Address; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
1937
|
use strict; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
174
|
|
4
|
4
|
|
|
4
|
|
20
|
use warnings; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
130
|
|
5
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
23
|
use vars '$VERSION'; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
296
|
|
7
|
|
|
|
|
|
|
$VERSION = '0.46'; |
8
|
|
|
|
|
|
|
|
9
|
4
|
|
|
|
|
46
|
use Class::Roles multi => |
10
|
|
|
|
|
|
|
{ |
11
|
|
|
|
|
|
|
address_expires => [qw( expires process_time )], |
12
|
|
|
|
|
|
|
address_named => [qw( name )], |
13
|
|
|
|
|
|
|
address_described => [qw( description )], |
14
|
4
|
|
|
4
|
|
3814
|
}; |
|
4
|
|
|
|
|
4878
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub description |
17
|
|
|
|
|
|
|
{ |
18
|
8
|
|
|
8
|
1
|
1412
|
my $self = shift; |
19
|
8
|
100
|
|
|
|
33
|
$self->{description} = shift if @_; |
20
|
|
|
|
|
|
|
|
21
|
8
|
100
|
|
|
|
49
|
return '' unless exists $self->{description}; |
22
|
6
|
|
|
|
|
26
|
return $self->{description}; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub name |
26
|
|
|
|
|
|
|
{ |
27
|
4
|
|
|
4
|
1
|
8
|
my $self = shift; |
28
|
4
|
100
|
|
|
|
21
|
($self->{name} = shift) =~ tr/-A-Za-z0-9_//cd if @_; |
29
|
4
|
|
|
|
|
24
|
return $self->{name}; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub expires |
33
|
|
|
|
|
|
|
{ |
34
|
5
|
|
|
5
|
1
|
9
|
my $self = shift; |
35
|
5
|
100
|
|
|
|
25
|
$self->{expires} = $self->process_time( shift ) + time() if @_; |
36
|
5
|
100
|
|
|
|
20
|
$self->{expires} = 0 unless $self->{expires}; |
37
|
5
|
|
|
|
|
27
|
return $self->{expires}; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub process_time |
41
|
|
|
|
|
|
|
{ |
42
|
9
|
|
|
9
|
1
|
23
|
my ($self, $time) = @_; |
43
|
9
|
100
|
|
|
|
41
|
return $time unless $time =~ tr/0-9//c; |
44
|
|
|
|
|
|
|
|
45
|
7
|
|
|
|
|
45
|
my %times = ( |
46
|
|
|
|
|
|
|
m => 60, |
47
|
|
|
|
|
|
|
h => 60 * 60, |
48
|
|
|
|
|
|
|
d => 24 * 60 * 60, |
49
|
|
|
|
|
|
|
w => 7 * 24 * 60 * 60, |
50
|
|
|
|
|
|
|
M => 30 * 24 * 60 * 60, |
51
|
|
|
|
|
|
|
); |
52
|
|
|
|
|
|
|
|
53
|
7
|
|
|
|
|
27
|
my $units = join('', keys %times); |
54
|
7
|
|
|
|
|
12
|
my $seconds; |
55
|
|
|
|
|
|
|
|
56
|
7
|
|
|
|
|
368
|
while ( $time =~ s/(\d+)([$units])// ) |
57
|
|
|
|
|
|
|
{ |
58
|
11
|
|
|
|
|
91
|
$seconds += $1 * $times{ $2 }; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
7
|
|
|
|
|
46
|
return $seconds; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |
65
|
|
|
|
|
|
|
__END__ |