| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# This code is part of Perl distribution Mail-Message version 4.04. |
|
2
|
|
|
|
|
|
|
# The POD got stripped from this file by OODoc version 3.06. |
|
3
|
|
|
|
|
|
|
# For contributors see file ChangeLog. |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# This software is copyright (c) 2001-2026 by Mark Overmeer. |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# This is free software; you can redistribute it and/or modify it under |
|
8
|
|
|
|
|
|
|
# the same terms as the Perl 5 programming language system itself. |
|
9
|
|
|
|
|
|
|
# SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
package Mail::Message::Field::Address;{ |
|
13
|
|
|
|
|
|
|
our $VERSION = '4.04'; |
|
14
|
|
|
|
|
|
|
} |
|
15
|
|
|
|
|
|
|
|
|
16
|
28
|
|
|
28
|
|
244
|
use parent 'Mail::Identity'; |
|
|
28
|
|
|
|
|
209
|
|
|
|
28
|
|
|
|
|
230
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
28
|
|
|
28
|
|
11523
|
use strict; |
|
|
28
|
|
|
|
|
60
|
|
|
|
28
|
|
|
|
|
938
|
|
|
19
|
28
|
|
|
28
|
|
167
|
use warnings; |
|
|
28
|
|
|
|
|
59
|
|
|
|
28
|
|
|
|
|
1948
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
28
|
|
|
28
|
|
202
|
use Log::Report 'mail-message', import => [ qw/__x error/ ]; |
|
|
28
|
|
|
|
|
91
|
|
|
|
28
|
|
|
|
|
324
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
28
|
|
|
28
|
|
6829
|
use Mail::Message::Field::Addresses (); |
|
|
28
|
|
|
|
|
138
|
|
|
|
28
|
|
|
|
|
863
|
|
|
24
|
28
|
|
|
28
|
|
173
|
use Mail::Message::Field::Full (); |
|
|
28
|
|
|
|
|
80
|
|
|
|
28
|
|
|
|
|
992
|
|
|
25
|
|
|
|
|
|
|
|
|
26
|
28
|
|
|
28
|
|
243
|
use Scalar::Util qw/blessed/; |
|
|
28
|
|
|
|
|
157
|
|
|
|
28
|
|
|
|
|
4350
|
|
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
my $format = 'Mail::Message::Field::Full'; |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
#-------------------- |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
use overload |
|
33
|
|
|
|
|
|
|
'""' => 'string', |
|
34
|
84
|
|
|
84
|
|
573
|
bool => sub {1}, |
|
35
|
28
|
|
|
28
|
|
195
|
cmp => sub { lc($_[0]->address) cmp lc($_[1]) }; |
|
|
28
|
|
|
0
|
|
85
|
|
|
|
28
|
|
|
|
|
443
|
|
|
|
0
|
|
|
|
|
0
|
|
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
#-------------------- |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub coerce($@) |
|
40
|
53
|
|
|
53
|
1
|
207
|
{ my ($class, $addr, %args) = @_; |
|
41
|
53
|
50
|
|
|
|
159
|
defined $addr or return (); |
|
42
|
53
|
100
|
|
|
|
157
|
blessed $addr or return $class->parse($addr); |
|
43
|
51
|
100
|
|
|
|
295
|
$addr->isa($class) and return $addr; |
|
44
|
|
|
|
|
|
|
|
|
45
|
4
|
50
|
0
|
|
|
27
|
my $from = $class->from($addr, %args) |
|
46
|
|
|
|
|
|
|
or error __x"cannot coerce a {type} into a {class}.", type => ref $addr // $addr, class => $class; |
|
47
|
|
|
|
|
|
|
|
|
48
|
4
|
|
|
|
|
41
|
bless $from, $class; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub init($) |
|
52
|
50
|
|
|
50
|
0
|
255329
|
{ my ($self, $args) = @_; |
|
53
|
50
|
|
|
|
|
309
|
$self->SUPER::init($args); |
|
54
|
50
|
|
|
|
|
3352
|
$self->{MMFA_encoding} = delete $args->{encoding}; |
|
55
|
50
|
|
|
|
|
187
|
$self; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub parse($) |
|
60
|
5
|
|
|
5
|
1
|
1019
|
{ my $self = shift; |
|
61
|
5
|
|
|
|
|
59
|
my $parsed = Mail::Message::Field::Addresses->new(To => shift); |
|
62
|
5
|
50
|
|
|
|
29
|
defined $parsed ? ($parsed->addresses)[0] : (); |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
#-------------------- |
|
66
|
|
|
|
|
|
|
|
|
67
|
64
|
|
|
64
|
1
|
2800
|
sub encoding() { $_[0]->{MMFA_encoding} } |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
#-------------------- |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub string() |
|
72
|
64
|
|
|
64
|
1
|
25435
|
{ my $self = shift; |
|
73
|
64
|
|
|
|
|
267
|
my @opts = (charset => $self->charset, encoding => $self->encoding); |
|
74
|
|
|
|
|
|
|
# language => $self->language |
|
75
|
|
|
|
|
|
|
|
|
76
|
64
|
|
|
|
|
120
|
my @parts; |
|
77
|
64
|
|
|
|
|
210
|
my $phrase = $self->phrase; |
|
78
|
64
|
100
|
|
|
|
1141
|
push @parts, $format->createPhrase($phrase, @opts) if defined $phrase; |
|
79
|
|
|
|
|
|
|
|
|
80
|
64
|
|
|
|
|
302
|
my $address = $self->address; |
|
81
|
64
|
100
|
|
|
|
1375
|
push @parts, @parts ? '<'.$address.'>' : $address; |
|
82
|
|
|
|
|
|
|
|
|
83
|
64
|
|
|
|
|
234
|
my $comment = $self->comment; |
|
84
|
64
|
100
|
|
|
|
1758
|
push @parts, $format->createComment($comment, @opts) if defined $comment; |
|
85
|
|
|
|
|
|
|
|
|
86
|
64
|
|
|
|
|
614
|
join ' ', @parts; |
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
1; |