line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mail::SimpleList::Alias; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
779
|
use strict; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
121
|
|
4
|
4
|
|
|
4
|
|
23
|
use warnings; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
129
|
|
5
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
463
|
use Mail::Action::Address; |
|
4
|
|
|
|
|
2007
|
|
|
4
|
|
|
|
|
113
|
|
7
|
4
|
|
|
4
|
|
1810
|
use Mail::Address; |
|
4
|
|
|
|
|
9470
|
|
|
4
|
|
|
|
|
158
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use Class::Roles |
10
|
4
|
|
|
|
|
24
|
does => 'address_expires', |
11
|
|
|
|
|
|
|
does => 'address_named', |
12
|
4
|
|
|
4
|
|
29
|
does => 'address_described'; |
|
4
|
|
|
|
|
9
|
|
13
|
|
|
|
|
|
|
|
14
|
4
|
|
|
4
|
|
523
|
use vars qw( $VERSION ); |
|
4
|
|
|
|
|
385
|
|
|
4
|
|
|
|
|
2386
|
|
15
|
|
|
|
|
|
|
$VERSION = '0.95'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub new |
18
|
|
|
|
|
|
|
{ |
19
|
40
|
|
|
40
|
1
|
101457
|
my $class = shift; |
20
|
40
|
|
|
|
|
428
|
bless { |
21
|
|
|
|
|
|
|
owner => '', |
22
|
|
|
|
|
|
|
closed => 0, |
23
|
|
|
|
|
|
|
expires => 0, |
24
|
|
|
|
|
|
|
auto_add => 1, |
25
|
|
|
|
|
|
|
description => '', |
26
|
|
|
|
|
|
|
members => [], |
27
|
|
|
|
|
|
|
@_ }, $class; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub members |
31
|
|
|
|
|
|
|
{ |
32
|
28
|
|
|
28
|
1
|
2850
|
my $self = shift; |
33
|
28
|
|
|
|
|
173
|
return $self->{members}; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub add |
37
|
|
|
|
|
|
|
{ |
38
|
19
|
|
|
19
|
1
|
942
|
my $self = shift; |
39
|
|
|
|
|
|
|
|
40
|
19
|
|
|
|
|
39
|
my %existing = map { $_ => 1 } @{ $self->{members} }; |
|
35
|
|
|
|
|
101
|
|
|
19
|
|
|
|
|
52
|
|
41
|
19
|
|
|
|
|
36
|
my $existing = @{ $self->{members} }; |
|
19
|
|
|
|
|
48
|
|
42
|
|
|
|
|
|
|
|
43
|
19
|
|
|
|
|
57
|
while (@_) |
44
|
|
|
|
|
|
|
{ |
45
|
25
|
100
|
|
|
|
69
|
my $address = shift or next; |
46
|
22
|
|
|
|
|
48
|
chomp $address; |
47
|
|
|
|
|
|
|
|
48
|
22
|
|
|
|
|
129
|
for my $member ( Mail::Address->parse( $address )) |
49
|
|
|
|
|
|
|
{ |
50
|
22
|
|
|
|
|
2946
|
$member = $member->address(); |
51
|
22
|
100
|
|
|
|
291
|
next if exists $existing{ $member }; |
52
|
16
|
|
|
|
|
31
|
push @{ $self->{members} }, $member; |
|
16
|
|
|
|
|
45
|
|
53
|
16
|
|
|
|
|
65
|
$existing{ $member } = 1; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
19
|
|
|
|
|
40
|
return @{ $self->{members} }[ $existing .. $#{ $self->{members} } ]; |
|
19
|
|
|
|
|
107
|
|
|
19
|
|
|
|
|
53
|
|
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub remove_address |
61
|
|
|
|
|
|
|
{ |
62
|
4
|
|
|
4
|
1
|
12
|
my ($self, $remove) = @_; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# Mail::Address format adds a newline |
65
|
4
|
|
|
|
|
7
|
chomp $remove; |
66
|
4
|
|
|
|
|
8
|
my $original = @{ $self->{members} }; |
|
4
|
|
|
|
|
10
|
|
67
|
|
|
|
|
|
|
|
68
|
4
|
|
|
|
|
8
|
$self->{members} = [ grep { $_ ne $remove } @{ $self->{members} } ]; |
|
18
|
|
|
|
|
42
|
|
|
4
|
|
|
|
|
10
|
|
69
|
4
|
50
|
|
|
|
17
|
$self->{owner} = '' if $self->{owner} eq $remove; |
70
|
|
|
|
|
|
|
|
71
|
4
|
|
|
|
|
6
|
return $original > @{ $self->{members} }; |
|
4
|
|
|
|
|
16
|
|
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub owner |
75
|
|
|
|
|
|
|
{ |
76
|
14
|
|
|
14
|
1
|
647
|
my $self = shift; |
77
|
14
|
100
|
|
|
|
51
|
$self->add( $self->{owner} = shift ) if @_; |
78
|
14
|
|
|
|
|
51
|
return $self->{owner}; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub closed |
82
|
|
|
|
|
|
|
{ |
83
|
14
|
|
|
14
|
1
|
167
|
my $self = shift; |
84
|
14
|
100
|
|
|
|
77
|
$self->{closed} = $self->is_true( $_[0] ) if @_; |
85
|
14
|
|
|
|
|
62
|
return $self->{closed}; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub is_true |
89
|
|
|
|
|
|
|
{ |
90
|
6
|
|
|
6
|
0
|
19
|
my ($self, $value) = @_; |
91
|
6
|
100
|
|
|
|
21
|
return 0 unless $value; |
92
|
5
|
100
|
|
|
|
27
|
return 0 if $value =~ /^[Nn]o/; |
93
|
3
|
|
|
|
|
9
|
return 1; |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub auto_add |
98
|
|
|
|
|
|
|
{ |
99
|
11
|
|
|
11
|
1
|
261
|
my $self = shift; |
100
|
11
|
100
|
|
|
|
45
|
$self->{auto_add} = $self->is_true( $_[0] ) if @_; |
101
|
11
|
|
|
|
|
40
|
return $self->{auto_add}; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub attributes |
105
|
|
|
|
|
|
|
{ |
106
|
11
|
|
|
11
|
1
|
1740
|
+{ map { $_ => 1 } qw( owner closed expires auto_add description name ) } |
|
66
|
|
|
|
|
149
|
|
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
1; |
110
|
|
|
|
|
|
|
__END__ |