| 1 | # Copyrights 2001-2023 by [Mark Overmeer <markov@cpan.org>]. | ||||||||||||||||||||||||||||
| 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::Addresses; | ||||||||||||||||||||||||||||
| 10 | 24 | ▶ | use vars '$VERSION'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 24 | $VERSION = '3.013'; | |||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 24 | ▶ | use base 'Mail::Message::Field::Structured'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 24 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | 24 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 24 | ▶ | use Mail::Message::Field::AddrGroup; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | 24 | ▶ | use Mail::Message::Field::Address; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | 24 | ▶ | use List::Util 'first'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | #------------------------------------------ | ||||||||||||||||||||||||||||
| 24 | # what is permitted for each field. | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 24 | my $address_list = {groups => 1, multi => 1}; | |||||||||||||||||||||||||||
| 27 | 24 | my $mailbox_list = {multi => 1}; | |||||||||||||||||||||||||||
| 28 | 24 | my $mailbox = {}; | |||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 24 | my %accepted = # defaults to $address_list | |||||||||||||||||||||||||||
| 31 | ( from => $mailbox_list | ||||||||||||||||||||||||||||
| 32 | , sender => $mailbox | ||||||||||||||||||||||||||||
| 33 | ); | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | sub init($) | ||||||||||||||||||||||||||||
| 36 | 14 | ▶ | { my ($self, $args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
init: called CC=9 SCAR=24.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 14 | $self->{MMFF_groups} = []; | |||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 14 | ( my $def = lc $args->{name} ) =~ s/^resent\-//; | |||||||||||||||||||||||||||
| 41 | 14 | ▶ | $self->{MMFF_defaults} = $accepted{$def} || $address_list; | ||||||||||||||||||||||||||
|
Condition66%2/3
$accepted{$def} || $address_list
MC/DC0%0/2
$accepted{$def} || $address_list
$accepted{$def}
$address_list
Truth table66%2/3
A || B
A= $accepted{$def}B= $address_list
| |||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 14 | my ($body, @body); | |||||||||||||||||||||||||||
| 44 | 14 | ▶ | if($body = $args->{body}) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 45 | 13 | ▶ | { @body = ref $body eq 'ARRAY' ? @$body : ($body); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 46 | 13 | ▶ | return () unless @body; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 14 | ▶ | if(@body > 1 || ref $body[0]) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@body > 1 or ref $body[0]
MC/DC0%0/2
@body > 1 or ref $body[0]
@body > 1
ref $body[0]
Truth table33%1/3
A or B
A= @body > 1B= ref $body[0]
| |||||||||||||||||||||||||||||
| 50 | 0 | { $self->addAddress($_) foreach @body; | |||||||||||||||||||||||||||
| 51 | 0 | delete $args->{body}; | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 14 | ▶ | $self->SUPER::init($args) or return; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 55 | 14 | $self; | |||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | #------------------------------------------ | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | sub addAddress(@) | ||||||||||||||||||||||||||||
| 62 | 23 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
addAddress: called CC=6 SCAR=18.8
Pod
documented
| |||||||||||||||||||||||||||||
| 63 | 23 | ▶ | my $email = @_ && ref $_[0] ? shift : undef; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@_ and ref $_[0]
MC/DC0%0/2
@_ and ref $_[0]
@_
ref $_[0]
Truth table33%1/3
A and B
A= @_B= ref $_[0]
| |||||||||||||||||||||||||||||
| 64 | 23 | my %args = @_; | |||||||||||||||||||||||||||
| 65 | 23 | ▶ | my $group = delete $args{group} || ''; | ||||||||||||||||||||||||||
|
Condition100%2/2
delete $args{'group'} || ''
MC/DC100%1/1
delete $args{'group'} || ''
delete $args{'group'}
Truth table100%2/2
A
A= delete $args{'group'}
| |||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | 23 | ▶ | $email = Mail::Message::Field::Address->new(%args) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 68 | unless defined $email; | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | 23 | ▶ | my $set = $self->group($group) || $self->addGroup(name => $group); | ||||||||||||||||||||||||||
|
Condition66%2/3
$self->group($group) || $self->addGroup('name', $group)
MC/DC50%1/2
$self->group($group) || $self->addGroup('name', $group)
$self->group($group)
$self->addGroup('name', $group)
Truth table66%2/3
A || B
A= $self->group($group)B= $self->addGroup('name', $group)
| |||||||||||||||||||||||||||||
| 71 | 23 | $set->addAddress($email); | |||||||||||||||||||||||||||
| 72 | 23 | $email; | |||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | sub addGroup(@) | ||||||||||||||||||||||||||||
| 77 | 13 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
addGroup: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 78 | 13 | ▶ | my $group = @_ == 1 ? shift | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 79 | : Mail::Message::Field::AddrGroup->new(@_); | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | 13 | push @{$self->{MMFF_groups}}, $group; | |||||||||||||||||||||||||||
| 82 | 13 | $group; | |||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | sub group($) | ||||||||||||||||||||||||||||
| 87 | 26 | ▶ | { my ($self, $name) = @_; | ||||||||||||||||||||||||||
|
Subroutine
group: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 88 | 26 | ▶ | $name = '' unless defined $name; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 89 | 26 | ▶ | first { lc($_->name) eq lc($name) } $self->groups; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | 43 | ▶ | sub groups() { @{shift->{MMFF_groups}} } | ||||||||||||||||||||||||||
|
Subroutine
groups: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | 0 | ▶ | sub groupNames() { map {$_->name} shift->groups } | ||||||||||||||||||||||||||
|
Subroutine
groupNames: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | 9 | ▶ | sub addresses() { map {$_->addresses} shift->groups } | ||||||||||||||||||||||||||
|
Subroutine
addresses: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | sub addAttribute($;@) | ||||||||||||||||||||||||||||
| 103 | 0 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
addAttribute: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 104 | 0 | $self->log(ERROR => 'No attributes for address fields.'); | |||||||||||||||||||||||||||
| 105 | 0 | $self; | |||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | #------------------------------------------ | ||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | sub parse($) | ||||||||||||||||||||||||||||
| 112 | 13 | ▶ | { my ($self, $string) = @_; | ||||||||||||||||||||||||||
|
Subroutine
parse: called CC=18 SCAR=29.4
Pod
documented
| |||||||||||||||||||||||||||||
| 113 | 13 | my ($group, $email) = ('', undef); | |||||||||||||||||||||||||||
| 114 | 13 | $string =~ s/\s+/ /gs; | |||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | ADDRESS: | ||||||||||||||||||||||||||||
| 117 | 13 | while(1) | |||||||||||||||||||||||||||
| 118 | 47 | { (my $comment, $string) = $self->consumeComment($string); | |||||||||||||||||||||||||||
| 119 | 47 | my $start_length = length $string; | |||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | 47 | ▶ | if($string =~ s/^\s*\;//s ) { $group = ''; next ADDRESS } # end group | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 122 | 44 | ▶ | if($string =~ s/^\s*\,//s ) { next ADDRESS} # end address | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | 32 | (my $email, $string) = $self->consumeAddress($string); | |||||||||||||||||||||||||||
| 125 | 32 | ▶ | if(defined $email) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 126 | { # Pattern starts with e-mail address | ||||||||||||||||||||||||||||
| 127 | 5 | ($comment, $string) = $self->consumeComment($string); | |||||||||||||||||||||||||||
| 128 | 5 | ▶ | $email->comment($comment) if defined $comment; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||
| 130 | else | ||||||||||||||||||||||||||||
| 131 | { # Pattern not plain address | ||||||||||||||||||||||||||||
| 132 | 27 | my $real_phrase = $string =~ m/^\s*\"/; | |||||||||||||||||||||||||||
| 133 | 27 | my @words; | |||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | # In rfc2822 obs-phrase, we can have more than one word with | ||||||||||||||||||||||||||||
| 136 | # comments inbetween. | ||||||||||||||||||||||||||||
| 137 | WORD: | ||||||||||||||||||||||||||||
| 138 | 27 | while(1) | |||||||||||||||||||||||||||
| 139 | 47 | { (my $word, $string) = $self->consumePhrase($string); | |||||||||||||||||||||||||||
| 140 | 47 | ▶ | defined $word or last; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | 23 | ▶ | push @words, $word if length $word; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 143 | 23 | ($comment, $string) = $self->consumeComment($string); | |||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | 23 | ▶ | if($string =~ s/^\s*\://s ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 146 | 3 | { $group = $word; | |||||||||||||||||||||||||||
| 147 | # even empty groups must appear | ||||||||||||||||||||||||||||
| 148 | 3 | ▶ | $self->addGroup(name => $group) unless $self->group($group); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 149 | 3 | next ADDRESS; | |||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||
| 152 | 24 | ▶ | my $phrase = @words ? join ' ', @words : undef; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||
| 154 | 24 | my $angle; | |||||||||||||||||||||||||||
| 155 | 24 | ▶ | if($string =~ s/^\s*\<([^>]*)\>//s) { $angle = $1 } | ||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||
| 156 | elsif($real_phrase) | ||||||||||||||||||||||||||||
| 157 | 0 | ▶ | { $self->log(ERROR => "Ignore unrelated phrase `$1'") | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 158 | if $string =~ s/^\s*\"(.*?)\r?\n//; | ||||||||||||||||||||||||||||
| 159 | 0 | next ADDRESS; | |||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||
| 161 | elsif(defined $phrase) | ||||||||||||||||||||||||||||
| 162 | 1 | { ($angle = $phrase) =~ s/\s+/./g; | |||||||||||||||||||||||||||
| 163 | 1 | undef $phrase; | |||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | 24 | ($comment, $string) = $self->consumeComment($string); | |||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||
| 168 | # remove obsoleted route info. | ||||||||||||||||||||||||||||
| 169 | 24 | ▶ | return 1 unless defined $angle; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 170 | 21 | $angle =~ s/^\@.*?\://; | |||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||
| 172 | 21 | ($email, $angle) = $self->consumeAddress($angle | |||||||||||||||||||||||||||
| 173 | , phrase => $phrase, comment => $comment); | ||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | 26 | ▶ | $self->addAddress($email, group => $group) if defined $email; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 177 | 26 | ▶ | return 1 if $string =~ m/^\s*$/s; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||
| 179 | # Do not get stuck on illegal characters | ||||||||||||||||||||||||||||
| 180 | 16 | ▶ | last if $start_length == length $string; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||
| 183 | 0 | $self->log(WARNING => 'Illegal part in address field '.$self->Name. ": $string\n"); | |||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||
| 185 | 0 | 0; | |||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | sub produceBody() | ||||||||||||||||||||||||||||
| 189 | 4 | ▶ | { my @groups = sort {$a->name cmp $b->name} shift->groups; | ||||||||||||||||||||||||||
|
Subroutine
produceBody: called CC=5 SCAR=17.0
Pod
documented
| |||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||
| 191 | 4 | ▶ | @groups or return ''; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 192 | 4 | ▶ | @groups > 1 or return $groups[0]->string; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||
| 194 | 2 | ▶ | my $plain | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$groups[0]->name eq "" and $groups[0]->addresses
MC/DC0%0/2
$groups[0]->name eq "" and $groups[0]->addresses
$groups[0]->name eq ""
$groups[0]->addresses
Truth table33%1/3
A and B
A= $groups[0]->name eq ""B= $groups[0]->addresses
| |||||||||||||||||||||||||||||
| 195 | = $groups[0]->name eq '' && $groups[0]->addresses | ||||||||||||||||||||||||||||
| 196 | ? (shift @groups)->string.',' | ||||||||||||||||||||||||||||
| 197 | : ''; | ||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||
| 199 | 2 | join ' ', $plain, (map $_->string, @groups); | |||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||
| 203 | sub consumeAddress($@) | ||||||||||||||||||||||||||||
| 204 | 53 | ▶ | { my ($self, $string, @options) = @_; | ||||||||||||||||||||||||||
|
Subroutine
consumeAddress: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||
| 206 | 53 | my ($local, $shorter, $loccomment); | |||||||||||||||||||||||||||
| 207 | 53 | ▶ | if($string =~ s/^\s*"((?:\\.|[^"])*)"\s*\@/@/) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 208 | { # local part is quoted-string rfc2822 | ||||||||||||||||||||||||||||
| 209 | 1 | ($local, $shorter) = ($1, $string); | |||||||||||||||||||||||||||
| 210 | 1 | $local =~ s/\\"/"/g; | |||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||
| 212 | else | ||||||||||||||||||||||||||||
| 213 | 52 | { ($local, $shorter, $loccomment) = $self->consumeDotAtom($string); | |||||||||||||||||||||||||||
| 214 | 52 | ▶ | $local =~ s/\s//g if defined $local; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||
| 217 | 53 | ▶ | defined $local && $shorter =~ s/^\s*\@// | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $local and $shorter =~ s/^\s*\@//
MC/DC100%2/2
defined $local and $shorter =~ s/^\s*\@//
defined $local
$shorter =~ s/^\s*\@//
Truth table100%3/3
A and B
A= defined $localB= $shorter =~ s/^\s*\@//
| |||||||||||||||||||||||||||||
| 218 | or return (undef, $string); | ||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||
| 220 | 23 | (my $domain, $shorter, my $domcomment) = $self->consumeDomain($shorter); | |||||||||||||||||||||||||||
| 221 | 23 | ▶ | defined $domain | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 222 | or return (undef, $string); | ||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||
| 224 | # loccomment and domcomment ignored | ||||||||||||||||||||||||||||
| 225 | 23 | my $email = Mail::Message::Field::Address | |||||||||||||||||||||||||||
| 226 | ->new(username => $local, domain => $domain, @options); | ||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | 23 | ($email, $shorter); | |||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||
| 232 | sub consumeDomain($) | ||||||||||||||||||||||||||||
| 233 | 23 | ▶ | { my ($self, $string) = @_; | ||||||||||||||||||||||||||
|
Subroutine
consumeDomain: called CC=3 SCAR=11.3
Pod
documented
| |||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||
| 235 | 23 | ▶ | return ($self->stripCFWS($1), $string) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 236 | if $string =~ s/\s*(\[(?:[^[]\\]*|\\.)*\])//; | ||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||
| 238 | 23 | my ($atom, $rest, $comment) = $self->consumeDotAtom($string); | |||||||||||||||||||||||||||
| 239 | 23 | ▶ | $atom =~ s/\s//g if defined $atom; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 240 | 23 | ($atom, $rest, $comment); | |||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||
| 243 | #------------------------------------------ | ||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||
| 246 | 24 | 1; | |||||||||||||||||||||||||||