line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyrights 2001-2022 by [Mark Overmeer ]. |
2
|
|
|
|
|
|
|
# For other contributors see ChangeLog. |
3
|
|
|
|
|
|
|
# See the manual pages for details on the licensing terms. |
4
|
|
|
|
|
|
|
# Pod stripped from pm file by OODoc 2.03. |
5
|
|
|
|
|
|
|
# This code is part of distribution Mail-Message. Meta-POD processed with |
6
|
|
|
|
|
|
|
# OODoc into POD and HTML manual-pages. See README.md |
7
|
|
|
|
|
|
|
# Copyright Mark Overmeer. Licensed under the same terms as Perl itself. |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
package Mail::Message::Field::Address; |
10
|
21
|
|
|
21
|
|
129
|
use vars '$VERSION'; |
|
21
|
|
|
|
|
41
|
|
|
21
|
|
|
|
|
1063
|
|
11
|
|
|
|
|
|
|
$VERSION = '3.012'; |
12
|
|
|
|
|
|
|
|
13
|
21
|
|
|
21
|
|
112
|
use base 'Mail::Identity'; |
|
21
|
|
|
|
|
38
|
|
|
21
|
|
|
|
|
1755
|
|
14
|
|
|
|
|
|
|
|
15
|
21
|
|
|
21
|
|
121
|
use strict; |
|
21
|
|
|
|
|
46
|
|
|
21
|
|
|
|
|
403
|
|
16
|
21
|
|
|
21
|
|
107
|
use warnings; |
|
21
|
|
|
|
|
135
|
|
|
21
|
|
|
|
|
674
|
|
17
|
|
|
|
|
|
|
|
18
|
21
|
|
|
21
|
|
539
|
use Mail::Message::Field::Addresses; |
|
21
|
|
|
|
|
51
|
|
|
21
|
|
|
|
|
728
|
|
19
|
21
|
|
|
21
|
|
110
|
use Mail::Message::Field::Full; |
|
21
|
|
|
|
|
125
|
|
|
21
|
|
|
|
|
1814
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my $format = 'Mail::Message::Field::Full'; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
use overload |
25
|
|
|
|
|
|
|
'""' => 'string' |
26
|
24
|
|
|
24
|
|
83
|
, bool => sub {1} |
27
|
0
|
|
|
0
|
|
0
|
, cmp => sub { lc($_[0]->address) eq lc($_[1]) } |
28
|
21
|
|
|
21
|
|
132
|
; |
|
21
|
|
|
|
|
41
|
|
|
21
|
|
|
|
|
184
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
#------------------------------------------ |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub coerce($@) |
34
|
32
|
|
|
32
|
1
|
65
|
{ my ($class, $addr, %args) = @_; |
35
|
32
|
50
|
|
|
|
67
|
return () unless defined $addr; |
36
|
|
|
|
|
|
|
|
37
|
32
|
100
|
|
|
|
57
|
ref $addr or return $class->parse($addr); |
38
|
31
|
100
|
|
|
|
161
|
$addr->isa($class) and return $addr; |
39
|
|
|
|
|
|
|
|
40
|
4
|
|
|
|
|
17
|
my $from = $class->from($addr, %args); |
41
|
|
|
|
|
|
|
|
42
|
4
|
50
|
|
|
|
99
|
Mail::Reporter->log(ERROR => "Cannot coerce a ".ref($addr)." into a $class"), |
43
|
|
|
|
|
|
|
return () unless defined $from; |
44
|
|
|
|
|
|
|
|
45
|
4
|
|
|
|
|
11
|
bless $from, $class; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub init($) |
49
|
24
|
|
|
24
|
0
|
2826
|
{ my ($self, $args) = @_; |
50
|
24
|
|
|
|
|
116
|
$self->SUPER::init($args); |
51
|
24
|
|
|
|
|
898
|
$self->{MMFA_encoding} = delete $args->{encoding}; |
52
|
24
|
|
|
|
|
43
|
$self; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub parse($) |
57
|
3
|
|
|
3
|
1
|
11
|
{ my $self = shift; |
58
|
3
|
|
|
|
|
25
|
my $parsed = Mail::Message::Field::Addresses->new(To => shift); |
59
|
3
|
50
|
|
|
|
15
|
defined $parsed ? ($parsed->addresses)[0] : (); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
#------------------------------------------ |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
83
|
|
|
83
|
1
|
1891
|
sub encoding() {shift->{MMFA_encoding}} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
#------------------------------------------ |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub string() |
71
|
83
|
|
|
83
|
1
|
13509
|
{ my $self = shift; |
72
|
83
|
|
|
|
|
165
|
my @opts = (charset => $self->charset, encoding => $self->encoding); |
73
|
|
|
|
|
|
|
# language => $self->language |
74
|
|
|
|
|
|
|
|
75
|
83
|
|
|
|
|
105
|
my @parts; |
76
|
83
|
|
|
|
|
153
|
my $phrase = $self->phrase; |
77
|
83
|
100
|
|
|
|
824
|
push @parts, $format->createPhrase($phrase, @opts) if defined $phrase; |
78
|
|
|
|
|
|
|
|
79
|
83
|
|
|
|
|
184
|
my $address = $self->address; |
80
|
83
|
100
|
|
|
|
1064
|
push @parts, @parts ? '<'.$address.'>' : $address; |
81
|
|
|
|
|
|
|
|
82
|
83
|
|
|
|
|
160
|
my $comment = $self->comment; |
83
|
83
|
100
|
|
|
|
1476
|
push @parts, $format->createComment($comment, @opts) if defined $comment; |
84
|
|
|
|
|
|
|
|
85
|
83
|
|
|
|
|
384
|
join ' ', @parts; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
1; |