line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mail::IMAP::Address; |
2
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
26
|
|
4
|
1
|
|
|
1
|
|
5
|
use utf8; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
6
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
25
|
use Encode (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use constant { |
9
|
1
|
|
|
|
|
191
|
NAME => 0, |
10
|
|
|
|
|
|
|
AT_DOMAIN_LIST => 1, |
11
|
|
|
|
|
|
|
MAILBOX => 2, |
12
|
|
|
|
|
|
|
HOST => 3, |
13
|
1
|
|
|
1
|
|
6
|
}; |
|
1
|
|
|
|
|
1
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub new { |
16
|
5
|
|
|
5
|
0
|
11
|
my ($class, $address) = @_; |
17
|
5
|
|
|
|
|
29
|
bless $address, $class; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
7618
|
use overload q("") => \&as_string; |
|
1
|
|
|
|
|
1292
|
|
|
1
|
|
|
|
|
12
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub _decode { |
23
|
18
|
|
|
18
|
|
45
|
my ($str) = @_; |
24
|
18
|
100
|
|
|
|
46
|
if ( defined($str) ) { |
25
|
16
|
|
|
|
|
17
|
eval { $str = Encode::decode( 'MIME-Header', $str ); }; |
|
16
|
|
|
|
|
70
|
|
26
|
|
|
|
|
|
|
} |
27
|
18
|
|
|
|
|
496
|
return $str; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
8
|
|
|
8
|
0
|
65
|
sub name { _decode( $_[0]->[NAME] ) } |
31
|
0
|
|
|
0
|
0
|
0
|
sub at_domain_list { _decode( $_[0]->[AT_DOMAIN_LIST] ) } |
32
|
5
|
|
|
5
|
0
|
14
|
sub mailbox { _decode( $_[0]->[MAILBOX] ) } |
33
|
5
|
|
|
5
|
0
|
12
|
sub host { _decode( $_[0]->[HOST] ) } |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub email { |
36
|
5
|
|
|
5
|
0
|
9
|
my ($self) = @_; |
37
|
5
|
|
|
|
|
11
|
return $self->mailbox . '@' . $self->host; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub as_string { |
41
|
5
|
|
|
5
|
0
|
20
|
my $self = shift; |
42
|
5
|
100
|
|
|
|
17
|
if ($self->name) { |
43
|
3
|
|
|
|
|
15
|
return sprintf("%s <%s>", $self->name, $self->email); |
44
|
|
|
|
|
|
|
} else { |
45
|
2
|
|
|
|
|
6
|
return $self->email; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
|