line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mail::SimpleList::Alias; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
78215
|
use strict; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
101
|
|
4
|
|
|
|
|
|
|
|
5
|
4
|
|
|
4
|
|
394
|
use Mail::Action::Address; |
|
4
|
|
|
|
|
1425
|
|
|
4
|
|
|
|
|
68
|
|
6
|
4
|
|
|
4
|
|
1917
|
use Mail::Address; |
|
4
|
|
|
|
|
7088
|
|
|
4
|
|
|
|
|
144
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use Class::Roles |
9
|
4
|
|
|
|
|
23
|
does => 'address_expires', |
10
|
|
|
|
|
|
|
does => 'address_named', |
11
|
4
|
|
|
4
|
|
26
|
does => 'address_described'; |
|
4
|
|
|
|
|
5
|
|
12
|
|
|
|
|
|
|
|
13
|
4
|
|
|
4
|
|
359
|
use vars qw( $VERSION ); |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
1630
|
|
14
|
|
|
|
|
|
|
$VERSION = '0.94'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub new |
17
|
|
|
|
|
|
|
{ |
18
|
40
|
|
|
40
|
1
|
65559
|
my $class = shift; |
19
|
40
|
|
|
|
|
274
|
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
|
2199
|
my $self = shift; |
32
|
28
|
|
|
|
|
114
|
return $self->{members}; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub add |
36
|
|
|
|
|
|
|
{ |
37
|
19
|
|
|
19
|
1
|
673
|
my $self = shift; |
38
|
|
|
|
|
|
|
|
39
|
19
|
|
|
|
|
31
|
my %existing = map { $_ => 1 } @{ $self->{members} }; |
|
35
|
|
|
|
|
75
|
|
|
19
|
|
|
|
|
46
|
|
40
|
19
|
|
|
|
|
20
|
my $existing = @{ $self->{members} }; |
|
19
|
|
|
|
|
28
|
|
41
|
|
|
|
|
|
|
|
42
|
19
|
|
|
|
|
45
|
while (@_) |
43
|
|
|
|
|
|
|
{ |
44
|
25
|
100
|
|
|
|
50
|
my $address = shift or next; |
45
|
22
|
|
|
|
|
27
|
chomp $address; |
46
|
|
|
|
|
|
|
|
47
|
22
|
|
|
|
|
63
|
for my $member ( Mail::Address->parse( $address )) |
48
|
|
|
|
|
|
|
{ |
49
|
22
|
|
|
|
|
1866
|
$member = $member->address(); |
50
|
22
|
100
|
|
|
|
179
|
next if exists $existing{ $member }; |
51
|
16
|
|
|
|
|
17
|
push @{ $self->{members} }, $member; |
|
16
|
|
|
|
|
31
|
|
52
|
16
|
|
|
|
|
49
|
$existing{ $member } = 1; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
19
|
|
|
|
|
22
|
return @{ $self->{members} }[ $existing .. $#{ $self->{members} } ]; |
|
19
|
|
|
|
|
78
|
|
|
19
|
|
|
|
|
28
|
|
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub remove_address |
60
|
|
|
|
|
|
|
{ |
61
|
4
|
|
|
4
|
1
|
7
|
my ($self, $remove) = @_; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# Mail::Address format adds a newline |
64
|
4
|
|
|
|
|
5
|
chomp $remove; |
65
|
4
|
|
|
|
|
4
|
my $original = @{ $self->{members} }; |
|
4
|
|
|
|
|
7
|
|
66
|
|
|
|
|
|
|
|
67
|
4
|
|
|
|
|
5
|
$self->{members} = [ grep { $_ ne $remove } @{ $self->{members} } ]; |
|
18
|
|
|
|
|
27
|
|
|
4
|
|
|
|
|
6
|
|
68
|
4
|
50
|
|
|
|
15
|
$self->{owner} = '' if $self->{owner} eq $remove; |
69
|
|
|
|
|
|
|
|
70
|
4
|
|
|
|
|
2
|
return $original > @{ $self->{members} }; |
|
4
|
|
|
|
|
15
|
|
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub owner |
74
|
|
|
|
|
|
|
{ |
75
|
14
|
|
|
14
|
1
|
324
|
my $self = shift; |
76
|
14
|
100
|
|
|
|
40
|
$self->add( $self->{owner} = shift ) if @_; |
77
|
14
|
|
|
|
|
36
|
return $self->{owner}; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub closed |
81
|
|
|
|
|
|
|
{ |
82
|
14
|
|
|
14
|
1
|
92
|
my $self = shift; |
83
|
14
|
100
|
|
|
|
36
|
$self->{closed} = $self->is_true( $_[0] ) if @_; |
84
|
14
|
|
|
|
|
43
|
return $self->{closed}; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub is_true |
88
|
|
|
|
|
|
|
{ |
89
|
6
|
|
|
6
|
0
|
9
|
my ($self, $value) = @_; |
90
|
6
|
100
|
|
|
|
15
|
return 0 unless $value; |
91
|
5
|
100
|
|
|
|
18
|
return 0 if $value =~ /^[Nn]o/; |
92
|
3
|
|
|
|
|
5
|
return 1; |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub auto_add |
97
|
|
|
|
|
|
|
{ |
98
|
11
|
|
|
11
|
1
|
148
|
my $self = shift; |
99
|
11
|
100
|
|
|
|
29
|
$self->{auto_add} = $self->is_true( $_[0] ) if @_; |
100
|
11
|
|
|
|
|
27
|
return $self->{auto_add}; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub attributes |
104
|
|
|
|
|
|
|
{ |
105
|
11
|
|
|
11
|
1
|
1416
|
+{ map { $_ => 1 } qw( owner closed expires auto_add description name ) } |
|
66
|
|
|
|
|
96
|
|
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
1; |
109
|
|
|
|
|
|
|
__END__ |