line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyrights 2001-2021 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.02. |
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
|
|
165
|
use vars '$VERSION'; |
|
21
|
|
|
|
|
50
|
|
|
21
|
|
|
|
|
1247
|
|
11
|
|
|
|
|
|
|
$VERSION = '3.011'; |
12
|
|
|
|
|
|
|
|
13
|
21
|
|
|
21
|
|
138
|
use base 'Mail::Identity'; |
|
21
|
|
|
|
|
51
|
|
|
21
|
|
|
|
|
2376
|
|
14
|
|
|
|
|
|
|
|
15
|
21
|
|
|
21
|
|
153
|
use strict; |
|
21
|
|
|
|
|
49
|
|
|
21
|
|
|
|
|
558
|
|
16
|
21
|
|
|
21
|
|
130
|
use warnings; |
|
21
|
|
|
|
|
155
|
|
|
21
|
|
|
|
|
850
|
|
17
|
|
|
|
|
|
|
|
18
|
21
|
|
|
21
|
|
771
|
use Mail::Message::Field::Addresses; |
|
21
|
|
|
|
|
47
|
|
|
21
|
|
|
|
|
862
|
|
19
|
21
|
|
|
21
|
|
144
|
use Mail::Message::Field::Full; |
|
21
|
|
|
|
|
143
|
|
|
21
|
|
|
|
|
2189
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my $format = 'Mail::Message::Field::Full'; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
use overload |
25
|
|
|
|
|
|
|
'""' => 'string' |
26
|
23
|
|
|
23
|
|
108
|
, bool => sub {1} |
27
|
0
|
|
|
0
|
|
0
|
, cmp => sub { lc($_[0]->address) eq lc($_[1]) } |
28
|
21
|
|
|
21
|
|
160
|
; |
|
21
|
|
|
|
|
51
|
|
|
21
|
|
|
|
|
262
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
#------------------------------------------ |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub coerce($@) |
34
|
31
|
|
|
31
|
1
|
77
|
{ my ($class, $addr, %args) = @_; |
35
|
31
|
50
|
|
|
|
74
|
return () unless defined $addr; |
36
|
|
|
|
|
|
|
|
37
|
31
|
100
|
|
|
|
77
|
ref $addr or return $class->parse($addr); |
38
|
30
|
100
|
|
|
|
148
|
$addr->isa($class) and return $addr; |
39
|
|
|
|
|
|
|
|
40
|
4
|
|
|
|
|
23
|
my $from = $class->from($addr, %args); |
41
|
|
|
|
|
|
|
|
42
|
4
|
50
|
|
|
|
146
|
Mail::Reporter->log(ERROR => "Cannot coerce a ".ref($addr)." into a $class"), |
43
|
|
|
|
|
|
|
return () unless defined $from; |
44
|
|
|
|
|
|
|
|
45
|
4
|
|
|
|
|
17
|
bless $from, $class; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub init($) |
49
|
22
|
|
|
22
|
0
|
939
|
{ my ($self, $args) = @_; |
50
|
22
|
|
|
|
|
106
|
$self->SUPER::init($args); |
51
|
22
|
|
|
|
|
1145
|
$self->{MMFA_encoding} = delete $args->{encoding}; |
52
|
22
|
|
|
|
|
55
|
$self; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub parse($) |
57
|
2
|
|
|
2
|
1
|
11
|
{ my $self = shift; |
58
|
2
|
|
|
|
|
17
|
my $parsed = Mail::Message::Field::Addresses->new(To => shift); |
59
|
2
|
50
|
|
|
|
11
|
defined $parsed ? ($parsed->addresses)[0] : (); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
#------------------------------------------ |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
81
|
|
|
81
|
1
|
2207
|
sub encoding() {shift->{MMFA_encoding}} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
#------------------------------------------ |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub string() |
71
|
81
|
|
|
81
|
1
|
13411
|
{ my $self = shift; |
72
|
81
|
|
|
|
|
211
|
my @opts = (charset => $self->charset, encoding => $self->encoding); |
73
|
|
|
|
|
|
|
# language => $self->language |
74
|
|
|
|
|
|
|
|
75
|
81
|
|
|
|
|
133
|
my @parts; |
76
|
81
|
|
|
|
|
214
|
my $phrase = $self->phrase; |
77
|
81
|
100
|
|
|
|
1076
|
push @parts, $format->createPhrase($phrase, @opts) if defined $phrase; |
78
|
|
|
|
|
|
|
|
79
|
81
|
|
|
|
|
222
|
my $address = $self->address; |
80
|
81
|
100
|
|
|
|
1375
|
push @parts, @parts ? '<'.$address.'>' : $address; |
81
|
|
|
|
|
|
|
|
82
|
81
|
|
|
|
|
225
|
my $comment = $self->comment; |
83
|
81
|
100
|
|
|
|
1841
|
push @parts, $format->createComment($comment, @opts) if defined $comment; |
84
|
|
|
|
|
|
|
|
85
|
81
|
|
|
|
|
470
|
join ' ', @parts; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
1; |