line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyrights 2001-2023 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
|
22
|
|
|
22
|
|
177
|
use vars '$VERSION'; |
|
22
|
|
|
|
|
57
|
|
|
22
|
|
|
|
|
1245
|
|
11
|
|
|
|
|
|
|
$VERSION = '3.013'; |
12
|
|
|
|
|
|
|
|
13
|
22
|
|
|
22
|
|
136
|
use base 'Mail::Identity'; |
|
22
|
|
|
|
|
51
|
|
|
22
|
|
|
|
|
2139
|
|
14
|
|
|
|
|
|
|
|
15
|
22
|
|
|
22
|
|
156
|
use strict; |
|
22
|
|
|
|
|
56
|
|
|
22
|
|
|
|
|
541
|
|
16
|
22
|
|
|
22
|
|
141
|
use warnings; |
|
22
|
|
|
|
|
142
|
|
|
22
|
|
|
|
|
790
|
|
17
|
|
|
|
|
|
|
|
18
|
22
|
|
|
22
|
|
592
|
use Mail::Message::Field::Addresses; |
|
22
|
|
|
|
|
60
|
|
|
22
|
|
|
|
|
794
|
|
19
|
22
|
|
|
22
|
|
141
|
use Mail::Message::Field::Full; |
|
22
|
|
|
|
|
163
|
|
|
22
|
|
|
|
|
2276
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my $format = 'Mail::Message::Field::Full'; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
use overload |
25
|
|
|
|
|
|
|
'""' => 'string' |
26
|
25
|
|
|
25
|
|
104
|
, bool => sub {1} |
27
|
0
|
|
|
0
|
|
0
|
, cmp => sub { lc($_[0]->address) cmp lc($_[1]) } |
28
|
22
|
|
|
22
|
|
171
|
; |
|
22
|
|
|
|
|
54
|
|
|
22
|
|
|
|
|
241
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
#------------------------------------------ |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub coerce($@) |
34
|
33
|
|
|
33
|
1
|
83
|
{ my ($class, $addr, %args) = @_; |
35
|
33
|
50
|
|
|
|
93
|
return () unless defined $addr; |
36
|
|
|
|
|
|
|
|
37
|
33
|
100
|
|
|
|
80
|
ref $addr or return $class->parse($addr); |
38
|
32
|
100
|
|
|
|
274
|
$addr->isa($class) and return $addr; |
39
|
|
|
|
|
|
|
|
40
|
4
|
|
|
|
|
24
|
my $from = $class->from($addr, %args); |
41
|
|
|
|
|
|
|
|
42
|
4
|
50
|
|
|
|
200
|
Mail::Reporter->log(ERROR => "Cannot coerce a ".ref($addr)." into a $class"), |
43
|
|
|
|
|
|
|
return () unless defined $from; |
44
|
|
|
|
|
|
|
|
45
|
4
|
|
|
|
|
13
|
bless $from, $class; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub init($) |
49
|
25
|
|
|
25
|
0
|
3399
|
{ my ($self, $args) = @_; |
50
|
25
|
|
|
|
|
111
|
$self->SUPER::init($args); |
51
|
25
|
|
|
|
|
1124
|
$self->{MMFA_encoding} = delete $args->{encoding}; |
52
|
25
|
|
|
|
|
57
|
$self; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub parse($) |
57
|
4
|
|
|
4
|
1
|
745
|
{ my $self = shift; |
58
|
4
|
|
|
|
|
28
|
my $parsed = Mail::Message::Field::Addresses->new(To => shift); |
59
|
4
|
50
|
|
|
|
19
|
defined $parsed ? ($parsed->addresses)[0] : (); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
#------------------------------------------ |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
83
|
|
|
83
|
1
|
1963
|
sub encoding() {shift->{MMFA_encoding}} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
#------------------------------------------ |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub string() |
71
|
83
|
|
|
83
|
1
|
17716
|
{ my $self = shift; |
72
|
83
|
|
|
|
|
202
|
my @opts = (charset => $self->charset, encoding => $self->encoding); |
73
|
|
|
|
|
|
|
# language => $self->language |
74
|
|
|
|
|
|
|
|
75
|
83
|
|
|
|
|
136
|
my @parts; |
76
|
83
|
|
|
|
|
168
|
my $phrase = $self->phrase; |
77
|
83
|
100
|
|
|
|
1001
|
push @parts, $format->createPhrase($phrase, @opts) if defined $phrase; |
78
|
|
|
|
|
|
|
|
79
|
83
|
|
|
|
|
242
|
my $address = $self->address; |
80
|
83
|
100
|
|
|
|
1365
|
push @parts, @parts ? '<'.$address.'>' : $address; |
81
|
|
|
|
|
|
|
|
82
|
83
|
|
|
|
|
204
|
my $comment = $self->comment; |
83
|
83
|
100
|
|
|
|
1902
|
push @parts, $format->createComment($comment, @opts) if defined $comment; |
84
|
|
|
|
|
|
|
|
85
|
83
|
|
|
|
|
420
|
join ' ', @parts; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
1; |