line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mail::SimpleList::Alias; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
1177
|
use strict; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
194
|
|
4
|
|
|
|
|
|
|
|
5
|
4
|
|
|
4
|
|
913
|
use Mail::Action::Address; |
|
4
|
|
|
|
|
2102
|
|
|
4
|
|
|
|
|
143
|
|
6
|
|
|
|
|
|
|
use Class::Roles |
7
|
4
|
|
|
|
|
26
|
does => 'address_expires', |
8
|
|
|
|
|
|
|
does => 'address_named', |
9
|
4
|
|
|
4
|
|
23
|
does => 'address_described'; |
|
4
|
|
|
|
|
9
|
|
10
|
|
|
|
|
|
|
|
11
|
4
|
|
|
4
|
|
3939
|
use Mail::Address; |
|
4
|
|
|
|
|
10582
|
|
|
4
|
|
|
|
|
285
|
|
12
|
|
|
|
|
|
|
|
13
|
4
|
|
|
4
|
|
34
|
use vars qw( $VERSION ); |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
2476
|
|
14
|
|
|
|
|
|
|
$VERSION = '0.92'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub new |
17
|
|
|
|
|
|
|
{ |
18
|
40
|
|
|
40
|
1
|
137981
|
my $class = shift; |
19
|
40
|
|
|
|
|
745
|
bless { |
20
|
|
|
|
|
|
|
owner => '', |
21
|
|
|
|
|
|
|
closed => 0, |
22
|
|
|
|
|
|
|
expires => 0, |
23
|
|
|
|
|
|
|
auto_add => 1, |
24
|
|
|
|
|
|
|
description => '', |
25
|
|
|
|
|
|
|
members => [], |
26
|
|
|
|
|
|
|
@_ }, $class; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub members |
30
|
|
|
|
|
|
|
{ |
31
|
28
|
|
|
28
|
1
|
5165
|
my $self = shift; |
32
|
28
|
|
|
|
|
208
|
return $self->{members}; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub add |
36
|
|
|
|
|
|
|
{ |
37
|
19
|
|
|
19
|
1
|
1153
|
my $self = shift; |
38
|
|
|
|
|
|
|
|
39
|
19
|
|
|
|
|
40
|
my %existing = map { $_ => 1 } @{ $self->{members} }; |
|
35
|
|
|
|
|
126
|
|
|
19
|
|
|
|
|
68
|
|
40
|
19
|
|
|
|
|
33
|
my $existing = @{ $self->{members} }; |
|
19
|
|
|
|
|
50
|
|
41
|
|
|
|
|
|
|
|
42
|
19
|
|
|
|
|
84
|
while (@_) |
43
|
|
|
|
|
|
|
{ |
44
|
25
|
100
|
|
|
|
621
|
my $address = shift or next; |
45
|
22
|
|
|
|
|
49
|
chomp $address; |
46
|
|
|
|
|
|
|
|
47
|
22
|
|
|
|
|
128
|
for my $member ( Mail::Address->parse( $address )) |
48
|
|
|
|
|
|
|
{ |
49
|
22
|
|
|
|
|
2924
|
$member = $member->address(); |
50
|
22
|
100
|
|
|
|
420
|
next if exists $existing{ $member }; |
51
|
16
|
|
|
|
|
29
|
push @{ $self->{members} }, $member; |
|
16
|
|
|
|
|
48
|
|
52
|
16
|
|
|
|
|
94
|
$existing{ $member } = 1; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
19
|
|
|
|
|
42
|
return @{ $self->{members} }[ $existing .. $#{ $self->{members} } ]; |
|
19
|
|
|
|
|
146
|
|
|
19
|
|
|
|
|
50
|
|
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub remove_address |
60
|
|
|
|
|
|
|
{ |
61
|
4
|
|
|
4
|
1
|
11
|
my ($self, $remove) = @_; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# Mail::Address format adds a newline |
64
|
4
|
|
|
|
|
9
|
chomp $remove; |
65
|
4
|
|
|
|
|
7
|
my $original = @{ $self->{members} }; |
|
4
|
|
|
|
|
11
|
|
66
|
|
|
|
|
|
|
|
67
|
4
|
|
|
|
|
8
|
$self->{members} = [ grep { $_ ne $remove } @{ $self->{members} } ]; |
|
18
|
|
|
|
|
42
|
|
|
4
|
|
|
|
|
30
|
|
68
|
4
|
50
|
|
|
|
20
|
$self->{owner} = '' if $self->{owner} eq $remove; |
69
|
|
|
|
|
|
|
|
70
|
4
|
|
|
|
|
5
|
return $original > @{ $self->{members} }; |
|
4
|
|
|
|
|
75
|
|
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub owner |
74
|
|
|
|
|
|
|
{ |
75
|
14
|
|
|
14
|
1
|
652
|
my $self = shift; |
76
|
14
|
100
|
|
|
|
49
|
$self->add( $self->{owner} = shift ) if @_; |
77
|
14
|
|
|
|
|
81
|
return $self->{owner}; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub closed |
81
|
|
|
|
|
|
|
{ |
82
|
14
|
|
|
14
|
1
|
156
|
my $self = shift; |
83
|
14
|
100
|
|
|
|
55
|
$self->{closed} = $self->is_true( $_[0] ) if @_; |
84
|
14
|
|
|
|
|
77
|
return $self->{closed}; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub is_true |
88
|
|
|
|
|
|
|
{ |
89
|
6
|
|
|
6
|
0
|
18
|
my ($self, $value) = @_; |
90
|
6
|
100
|
|
|
|
24
|
return 0 unless $value; |
91
|
5
|
100
|
|
|
|
32
|
return 0 if $value =~ /^[Nn]o/; |
92
|
3
|
|
|
|
|
11
|
return 1; |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub auto_add |
97
|
|
|
|
|
|
|
{ |
98
|
11
|
|
|
11
|
1
|
231
|
my $self = shift; |
99
|
11
|
100
|
|
|
|
155
|
$self->{auto_add} = $self->is_true( $_[0] ) if @_; |
100
|
11
|
|
|
|
|
53
|
return $self->{auto_add}; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub attributes |
104
|
|
|
|
|
|
|
{ |
105
|
11
|
|
|
11
|
1
|
1763
|
+{ map { $_ => 1 } qw( owner closed expires auto_add description name ) } |
|
66
|
|
|
|
|
163
|
|
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
1; |
109
|
|
|
|
|
|
|
__END__ |