MIME.pm

filter: Statementstmt 97.8% 356 / 364 Branchbran 81.1% 99 / 122 Conditioncond 68.3% 54 / 79 MC/DCmcdc 48.8% 22 / 45 Subroutinesub 98.2% 56 / 57 Podpod 80.5% 29 / 36 totaltotal 87.6% 616 / 703 CC 104 SCAR 20.0
CC
104
Cov
90%
create
21.3
parts_multipart
14.1
__ANON__
9.5
CRAP 7.4
↑ Summary MIME/Header/AddressList.pm »
1 19 ▶use v5.12.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 19 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 package Email::MIME 1.954;
4 # ABSTRACT: easy MIME message handling
5  
6 19 ▶use Email::Simple 2.212; # nth header value
Subroutine BEGIN: called CC=1 SCAR=0.0
7 19 ▶use parent qw(Email::Simple);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 19 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
10 19 ▶use Email::MessageID;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 19 ▶use Email::MIME::Creator;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 19 ▶use Email::MIME::ContentType 1.023; # build_content_type
Subroutine BEGIN: called CC=1 SCAR=0.0
13 19 ▶use Email::MIME::Encode;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 19 ▶use Email::MIME::Encodings 1.314;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 19 ▶use Email::MIME::Header;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 19 ▶use Encode 1.9801 ();
Subroutine BEGIN: called CC=1 SCAR=0.0
17 19 ▶use Scalar::Util qw(reftype weaken);
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 19 our @CARP_NOT = qw(Email::MIME::ContentType);
20  
21 19 our $MAX_DEPTH = 10;
22  
23 19 our $CUR_PARTS = 0;
24 19 our $MAX_PARTS = 100;
25  
26 #pod =head1 SYNOPSIS
27 #pod
28 #pod B<Wait!> Before you read this, maybe you just need L<Email::Stuffer>, which is
29 #pod a much easier-to-use tool for building simple email messages that might have
30 #pod attachments or both plain text and HTML. If that doesn't do it for you, then
31 #pod by all means keep reading.
32 #pod
33 #pod use Email::MIME;
34 #pod my $parsed = Email::MIME->new($message);
35 #pod
36 #pod my @parts = $parsed->parts; # These will be Email::MIME objects, too.
37 #pod my $decoded = $parsed->body;
38 #pod my $non_decoded = $parsed->body_raw;
39 #pod
40 #pod my $content_type = $parsed->content_type;
41 #pod
42 #pod ...or...
43 #pod
44 #pod use Email::MIME;
45 #pod use IO::All;
46 #pod
47 #pod # multipart message
48 #pod my @parts = (
49 #pod Email::MIME->create(
50 #pod attributes => {
51 #pod filename => "report.pdf",
52 #pod content_type => "application/pdf",
53 #pod encoding => "quoted-printable",
54 #pod name => "2004-financials.pdf",
55 #pod },
56 #pod body => io( "2004-financials.pdf" )->binary->all,
57 #pod ),
58 #pod Email::MIME->create(
59 #pod attributes => {
60 #pod content_type => "text/plain",
61 #pod disposition => "attachment",
62 #pod charset => "US-ASCII",
63 #pod },
64 #pod body_str => "Hello there!",
65 #pod ),
66 #pod );
67 #pod
68 #pod my $email = Email::MIME->create(
69 #pod header_str => [
70 #pod From => 'casey@geeknest.com',
71 #pod To => [ 'user1@host.com', 'Name <user2@host.com>' ],
72 #pod Cc => Email::Address::XS->new("Display Name \N{U+1F600}", 'user@example.com'),
73 #pod ],
74 #pod parts => [ @parts ],
75 #pod );
76 #pod
77 #pod # nesting parts
78 #pod $email->parts_set(
79 #pod [
80 #pod $email->parts,
81 #pod Email::MIME->create( parts => [ @parts ] ),
82 #pod ],
83 #pod );
84 #pod
85 #pod # standard modifications
86 #pod $email->header_str_set( 'X-PoweredBy' => 'RT v3.0' );
87 #pod $email->header_str_set( To => rcpts() );
88 #pod $email->header_str_set( Cc => aux_rcpts() );
89 #pod $email->header_str_set( Bcc => sekrit_rcpts() );
90 #pod
91 #pod # more advanced
92 #pod $_->encoding_set( 'base64' ) for $email->parts;
93 #pod
94 #pod # Quick multipart creation
95 #pod my $email = Email::MIME->create(
96 #pod header_str => [
97 #pod From => 'my@address',
98 #pod To => 'your@address',
99 #pod ],
100 #pod parts => [
101 #pod q[This is part one],
102 #pod q[This is part two],
103 #pod q[These could be binary too],
104 #pod ],
105 #pod );
106 #pod
107 #pod print $email->as_string;
108 #pod
109 #pod =head1 DESCRIPTION
110 #pod
111 #pod This is an extension of the L<Email::Simple> module, to handle MIME
112 #pod encoded messages. It takes a message as a string, splits it up into its
113 #pod constituent parts, and allows you access to various parts of the
114 #pod message. Headers are decoded from MIME encoding.
115 #pod
116 #pod =head1 METHODS
117 #pod
118 #pod Please see L<Email::Simple> for the base set of methods. It won't take
119 #pod very long. Added to that, you have:
120 #pod
121 #pod =cut
122  
123 19 our $CREATOR = 'Email::MIME::Creator';
124  
125 19 my $NO_ENCODE_RE = qr/
126 \A
127 (?:7bit|8bit|binary)\s*(?:;|$)
128 /ix;
129  
130 82 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
131 82 local $CUR_PARTS = 0;
132 82 my ($class, @rest) = @_;
133 82 $class->_new(@rest);
134 }
135  
136 164 ▶sub _new {
Subroutine _new: called CC=3 SCAR=11.0
137 164 my ($class, $text, $arg, @rest) = @_;
138 164 ▶ $arg ||= {};
Condition100%2/2
$arg ||= {}
l!l
13826
MC/DC100%1/1
$arg ||= {}
$arg
Truth table100%2/2
A
A= $arg
Aresult
11
00
139  
140 my $encode_check = exists $arg->{encode_check}
141 ? delete $arg->{encode_check}
142 164 ▶ : Encode::FB_CROAK;
Branch: 1 branch
BranchTrueFalseTotal
exists $arg->{'encode_check'} ? : 87 77 164
143  
144 164 my $self = shift->SUPER::new($text, $arg, @rest);
145 164 $self->encode_check_set($encode_check);
146 164 $self->{ct} = parse_content_type($self->content_type_raw);
147 164 $self->parts;
148 164 return $self;
149 }
150  
151 #pod =method create
152 #pod
153 #pod my $single = Email::MIME->create(
154 #pod header_str => [ ... ],
155 #pod body_str => '...',
156 #pod attributes => { ... },
157 #pod );
158 #pod
159 #pod my $multi = Email::MIME->create(
160 #pod header_str => [ ... ],
161 #pod parts => [ ... ],
162 #pod attributes => { ... },
163 #pod );
164 #pod
165 #pod This method creates a new MIME part. The C<header_str> parameter is a list of
166 #pod headers pairs to include in the message. The value for each pair is expected to
167 #pod be a text string that will be MIME-encoded as needed. Alternatively it can be
168 #pod an object with C<as_mime_string> method which implements conversion of that
169 #pod object to MIME-encoded string. That object method is called with two named
170 #pod input parameters: C<charset> and C<header_name_length>. It should return
171 #pod MIME-encoded representation of the object. As of 2017-07-25, the
172 #pod header-value-as-object code is very young, and may yet change.
173 #pod
174 #pod In case header name is registered in C<%Email::MIME::Header::header_to_class_map>
175 #pod hash then registered class is used for conversion from Unicode string to 8bit
176 #pod MIME encoding. Value can be either string or array reference to strings.
177 #pod Object is constructed via method C<from_string> with string value (or values
178 #pod in case of array reference) and converted to MIME-encoded string via
179 #pod C<as_mime_string> method.
180 #pod
181 #pod A similar C<header> parameter can be provided in addition to or instead of
182 #pod C<header_str>. Its values will be used verbatim.
183 #pod
184 #pod C<attributes> is a hash of MIME attributes to assign to the part, and may
185 #pod override portions of the header set in the C<header> parameter. The hash keys
186 #pod correspond directly to methods for modifying a message. The allowed keys are:
187 #pod content_type, charset, name, format, boundary, encoding, disposition, and
188 #pod filename. They will be mapped to C<"$attr\_set"> for message modification.
189 #pod
190 #pod The C<parts> parameter is a list reference containing C<Email::MIME>
191 #pod objects. Elements of the C<parts> list can also be a non-reference
192 #pod string of data. In that case, an C<Email::MIME> object will be created
193 #pod for you. Simple checks will determine if the part is binary or not, and
194 #pod all parts created in this fashion are encoded with C<base64>, just in case.
195 #pod
196 #pod If C<body> is given instead of C<parts>, it specifies the body to be used for a
197 #pod flat (subpart-less) MIME message. It is assumed to be a sequence of octets.
198 #pod
199 #pod If C<body_str> is given instead of C<body> or C<parts>, it is assumed to be a
200 #pod character string to be used as the body. If you provide a C<body_str>
201 #pod parameter, you B<must> provide C<charset> and C<encoding> attributes.
202 #pod
203 #pod =cut
204  
205 19 my %CT_SETTER = map {; $_ => 1 } qw(
206 content_type charset name format boundary
207 encoding
208 disposition filename
209 );
210  
211 54 ▶sub create {
Subroutine create: called CC=21 SCAR=30.6
Pod documented
212 54 my ($class, %args) = @_;
213  
214 54 my $header = '';
215 54 my %headers;
216 54 ▶ if (exists $args{header}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args{"header"}) 8 46 54
217 8 my @headers = @{ $args{header} };
218 8 ▶ pop @headers if @headers % 2 == 1;
Branch: 1 branch
BranchTrueFalseTotal
if @headers % 2 == 1 0 8 8
219 8 ▶ while (my ($key, $value) = splice @headers, 0, 2) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = splice(@headers, 0, 2)) 16 8 24
220 16 $headers{$key} = 1;
221 16 $CREATOR->_add_to_header(\$header, $key, $value);
222 }
223 }
224  
225 54 ▶ if (exists $args{header_str}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args{"header_str"}) 11 43 54
226 11 my @headers = @{ $args{header_str} };
227 11 ▶ pop @headers if @headers % 2 == 1;
Branch: 1 branch
BranchTrueFalseTotal
if @headers % 2 == 1 0 11 11
228 11 ▶ while (my ($key, $value) = splice @headers, 0, 2) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = splice(@headers, 0, 2)) 23 11 34
229 23 $headers{$key} = 1;
230  
231 23 $value = Email::MIME::Encode::maybe_mime_encode_header(
232 $key, $value, 'UTF-8'
233 );
234 23 $CREATOR->_add_to_header(\$header, $key, $value);
235 }
236 }
237  
238 $CREATOR->_add_to_header(\$header, Date => $CREATOR->_date_header)
239 54 ▶ unless exists $headers{Date};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $headers{"Date"} 54 0 54
240 54 $CREATOR->_add_to_header(\$header, 'MIME-Version' => '1.0',);
241  
242 54 ▶ my %attrs = $args{attributes} ? %{ $args{attributes} } : ();
Branch: 1 branch
BranchTrueFalseTotal
$args{'attributes'} ? : 31 23 54
243  
244 # XXX: This is awful... but if we don't do this, then Email::MIME->new will
245 # end up calling parse_content_type($self->content_type) which will mean
246 # parse_content_type(undef) which, for some reason, returns the default.
247 # It's really sort of mind-boggling. Anyway, the default ends up being
248 # q{text/plain; charset="us-ascii"} so that if content_type is in the
249 # attributes, but not charset, then charset isn't changed and you up with
250 # something that's q{image/jpeg; charset="us-ascii"} and you look like a
251 # moron. -- rjbs, 2009-01-20
252 54 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if (grep {exists $attrs{$_};} "content_type", "charset", "name", "format", "boundary") 30 24 54
253 270 grep { exists $attrs{$_} } qw(content_type charset name format boundary)
254 ) {
255 30 $CREATOR->_add_to_header(\$header, 'Content-Type' => 'text/plain',);
256 }
257  
258 54 my %pass_on;
259  
260 54 ▶ if (exists $args{encode_check}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args{"encode_check"}) 3 51 54
261 3 $pass_on{encode_check} = $args{encode_check};
262 }
263  
264 54 my $email = $class->new($header, \%pass_on);
265  
266 54 for my $key (sort keys %attrs) {
267 64 $email->content_type_attribute_set($key => $attrs{$key});
268 }
269  
270 54 my $body_args = grep { defined $args{$_} } qw(parts body body_str);
271 54 ▶ Carp::confess("only one of parts, body, or body_str may be given")
Branch: 1 branch
BranchTrueFalseTotal
if $body_args > 1 0 54 54
272 if $body_args > 1;
273  
274 54 ▶ if ($args{parts} && @{ $args{parts} }) {
Branch: 3 branches
BranchTrueFalseTotal
if ($args{'parts'} and @{$args{'parts'};}) { } 14 40 54
elsif (defined $args{'body'}) { } 33 7 40
elsif (defined $args{'body_str'}) { } 6 1 7
Condition66%2/3
$args{"parts"} and @{$args{"parts"};}
!ll&&!rl&&r
40014
MC/DC50%1/2
$args{"parts"} and @{$args{"parts"};}
$args{"parts"} @{$args{"parts"};}
Truth table66%2/3
A and B
A= $args{"parts"}B= @{$args{"parts"};}
ABresult
0X0
100
111
275 14 foreach my $part (@{ $args{parts} }) {
276 25 ▶ $part = $CREATOR->_construct_part($part)
Branch: 1 branch
BranchTrueFalseTotal
unless ref $part 14 11 25
277 unless ref($part);
278 }
279 14 $email->parts_set($args{parts});
280 } elsif (defined $args{body}) {
281 33 $email->body_set($args{body});
282 } elsif (defined $args{body_str}) {
283 Carp::confess("body_str was given, but no charset is defined")
284 6 ▶ unless my $charset = $attrs{charset};
Branch: 1 branch
BranchTrueFalseTotal
unless my $charset = $attrs{"charset"} 0 6 6
285  
286 Carp::confess("body_str was given, but no encoding is defined")
287 6 ▶ unless $attrs{encoding};
Branch: 1 branch
BranchTrueFalseTotal
unless $attrs{"encoding"} 0 6 6
288  
289 6 my $body_octets = Encode::encode($attrs{charset}, $args{body_str}, $email->encode_check);
290 4 $email->body_set($body_octets);
291 }
292  
293 52 $email;
294 }
295  
296 145 ▶sub as_string {
Subroutine as_string: called CC=2 SCAR=7.2
Pod documented
297 145 my $self = shift;
298 return $self->__head->as_string
299 145 ▶ . ($self->{mycrlf} || "\n") # XXX: replace with ->crlf
Condition50%1/2
$self->{'mycrlf'} || "\n"
l!l
1450
MC/DC0%0/1
$self->{'mycrlf'} || "\n"
$self->{'mycrlf'}
Truth table50%1/2
A
A= $self->{'mycrlf'}
Aresult
11
00
300 . $self->body_raw;
301 }
302  
303 302 ▶sub parts {
Subroutine parts: called CC=3 SCAR=11.0
Pod documented
304 302 my $self = shift;
305  
306 302 ▶ $self->fill_parts unless $self->{parts};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"parts"} 164 138 302
307  
308 302 my @parts = @{ $self->{parts} };
309 302 ▶ @parts = $self unless @parts;
Branch: 1 branch
BranchTrueFalseTotal
unless @parts 197 105 302
310 302 return @parts;
311 }
312  
313 52 ▶sub subparts {
Subroutine subparts: called CC=2 SCAR=7.0
Pod documented
314 52 my ($self) = @_;
315  
316 52 ▶ $self->fill_parts unless $self->{parts};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"parts"} 0 52 52
317 52 my @parts = @{ $self->{parts} };
318 52 return @parts;
319 }
320  
321 193 ▶sub fill_parts {
Subroutine fill_parts: called CC=3 SCAR=11.0
Pod undocumented
322 193 my $self = shift;
323  
324 193 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'ct'}{'type'} eq 'multipart' or $self->{'ct'}{'type'} eq 'message') { } 41 152 193
Condition66%2/3
$self->{"ct"}{"type"} eq "multipart" or $self->{"ct"}{"type"} eq "message"
l!l&&r!l&&!r
410152
MC/DC50%1/2
$self->{"ct"}{"type"} eq "multipart" or $self->{"ct"}{"type"} eq "message"
$self->{"ct"}{"type"} eq "multipart" $self->{"ct"}{"type"} eq "message"
Truth table66%2/3
A or B
A= $self->{"ct"}{"type"} eq "multipart"B= $self->{"ct"}{"type"} eq "message"
ABresult
1X1
011
000
325 $self->{ct}{type} eq "multipart"
326 or $self->{ct}{type} eq "message"
327 ) {
328 41 $self->parts_multipart;
329 } else {
330 152 $self->parts_single_part;
331 }
332  
333 193 return $self;
334 }
335  
336 106 ▶sub body {
Subroutine body: called CC=6 SCAR=18.0
Pod documented
337 106 my $self = shift;
338 106 my $body = $self->SUPER::body;
339 106 ▶ my $cte = $self->header("Content-Transfer-Encoding") || '';
Condition100%2/2
$self->header('Content-Transfer-Encoding') || ''
l!l
5551
MC/DC100%1/1
$self->header('Content-Transfer-Encoding') || ''
$self->header('Content-Transfer-Encoding')
Truth table100%2/2
A
A= $self->header('Content-Transfer-Encoding')
Aresult
11
00
340  
341 106 $cte =~ s/\A\s+//;
342 106 $cte =~ s/\s+\z//;
343 106 $cte =~ s/;.+//; # For S/MIME, etc.
344  
345 106 ▶ return $body unless $cte;
Branch: 1 branch
BranchTrueFalseTotal
unless $cte 51 55 106
346  
347 55 ▶ if (!$self->force_decode_hook and $cte =~ $NO_ENCODE_RE) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->force_decode_hook and $cte =~ /$NO_ENCODE_RE/u) 26 29 55
Condition66%2/3
not $self->force_decode_hook and $cte =~ /$NO_ENCODE_RE/u
!ll&&!rl&&r
02926
MC/DC50%1/2
not $self->force_decode_hook and $cte =~ /$NO_ENCODE_RE/u
not $self->force_decode_hook $cte =~ /$NO_ENCODE_RE/u
Truth table66%2/3
not(A) and B
A= not $self->force_decode_hookB= $cte =~ /$NO_ENCODE_RE/u
ABresult
0X0
100
111
348 26 return $body;
349 }
350  
351 29 ▶ $body = $self->decode_hook($body) if $self->can("decode_hook");
Branch: 1 branch
BranchTrueFalseTotal
if $self->can("decode_hook") 29 0 29
352  
353 29 $body = Email::MIME::Encodings::decode($cte, $body, '7bit');
354 29 return $body;
355 }
356  
357 152 ▶sub parts_single_part {
Subroutine parts_single_part: called CC=1 SCAR=0.0
Pod undocumented
358 152 my $self = shift;
359 152 $self->{parts} = [];
360 152 return $self;
361 }
362  
363 237 ▶sub body_raw {
Subroutine body_raw: called CC=2 SCAR=7.2
Pod documented
364 237 ▶ return $_[0]->{body_raw} || $_[0]->SUPER::body;
Condition66%2/3
$_[0]{'body_raw'} || $_[0]->SUPER::body
l!l&&r!l&&!r
23601
MC/DC50%1/2
$_[0]{'body_raw'} || $_[0]->SUPER::body
$_[0]{'body_raw'} $_[0]->SUPER::body
Truth table66%2/3
A || B
A= $_[0]{'body_raw'}B= $_[0]->SUPER::body
ABresult
1X1
011
000
365 }
366  
367 14 ▶sub body_str {
Subroutine body_str: called CC=5 SCAR=16.3
Pod documented
368 14 my ($self) = @_;
369 14 my $encoding = $self->{ct}{attributes}{charset};
370  
371 14 ▶ unless ($encoding) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($encoding) 2 12 14
372 2 ▶ if ($self->{ct}{type} eq 'text'
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"ct"}{"type"} eq "text" and $self->{"ct"}{"subtype"} eq "plain" || $self->{"ct"}{"subtype"} eq "html") 1 1 2
Condition50%3/6
$self->{"ct"}{"type"} eq "text" and $self->{"ct"}{"subtype"} eq "plain" || $self->{"ct"}{"subtype"} eq "html"
!ll&&!rl&&r
101
$self->{"ct"}{"subtype"} eq "plain" or $self->{"ct"}{"subtype"} eq "html"
l!l&&r!l&&!r
100
MC/DC33%1/3
$self->{"ct"}{"type"} eq "text" and $self->{"ct"}{"subtype"} eq "plain" || $self->{"ct"}{"subtype"} eq "html"
$self->{"ct"}{"type"} eq "text" $self->{"ct"}{"subtype"} eq "plain" $self->{"ct"}{"subtype"} eq "html"
Truth table50%2/4
A and B or C
A= $self->{"ct"}{"type"} eq "text"B= $self->{"ct"}{"subtype"} eq "plain"C= $self->{"ct"}{"subtype"} eq "html"
ABCresult
0XX0
1000
11X1
1011
373 and
374 ($self->{ct}{subtype} eq 'plain' or $self->{ct}{subtype} eq 'html')
375 ) {
376  
377 # assume that plaintext or html without ANY charset is us-ascii
378 1 return $self->body;
379 }
380  
381 1 Carp::confess("can't get body as a string for " . $self->content_type);
382 }
383  
384 12 my $str = Encode::decode($encoding, $self->body, $self->encode_check);
385 10 return $str;
386 }
387  
388 41 ▶sub parts_multipart {
Subroutine parts_multipart: called CC=12 SCAR=26.5
Pod undocumented
389 41 my $self = shift;
390 41 my $boundary = $self->{ct}->{attributes}->{boundary};
391  
392 41 ▶ our $DEPTH ||= 0;
Condition100%2/2
our $DEPTH ||= 0
l!l
1130
MC/DC100%1/1
our $DEPTH ||= 0
our $DEPTH
Truth table100%2/2
A
A= our $DEPTH
Aresult
11
00
393  
394 41 ▶ Carp::croak("attempted to parse a MIME message more than $MAX_DEPTH deep")
Branch: 1 branch
BranchTrueFalseTotal
if $Email::MIME::MAX_DEPTH and $Email::MIME::DEPTH > $Email::MIME::MAX_DEPTH 0 41 41
Condition33%1/3
$Email::MIME::MAX_DEPTH and $Email::MIME::DEPTH > $Email::MIME::MAX_DEPTH
!ll&&!rl&&r
0410
MC/DC0%0/2
$Email::MIME::MAX_DEPTH and $Email::MIME::DEPTH > $Email::MIME::MAX_DEPTH
$Email::MIME::MAX_DEPTH $Email::MIME::DEPTH > $Email::MIME::MAX_DEPTH
Truth table33%1/3
A and B
A= $Email::MIME::MAX_DEPTHB= $Email::MIME::DEPTH > $Email::MIME::MAX_DEPTH
ABresult
0X0
100
111
395 if $MAX_DEPTH && $DEPTH > $MAX_DEPTH;
396  
397 # Take a message, join all its lines together. Now try to Email::MIME->new
398 # it with 1.861 or earlier. Death! It tries to recurse endlessly on the
399 # body, because every time it splits on boundary it gets itself. Obviously
400 # that means it's a bogus message, but a mangled result (or exception) is
401 # better than endless recursion. -- rjbs, 2008-01-07
402 41 ▶ return $self->parts_single_part
Branch: 1 branch
BranchTrueFalseTotal
unless length $boundary and $self->body_raw =~ /^--\Q$boundary\E\s*$/msu 0 41 41
Condition33%1/3
length $boundary and $self->body_raw =~ /^--\Q$boundary\E\s*$/msu
!ll&&!rl&&r
0041
MC/DC0%0/2
length $boundary and $self->body_raw =~ /^--\Q$boundary\E\s*$/msu
length $boundary $self->body_raw =~ /^--\Q$boundary\E\s*$/msu
Truth table33%1/3
A and B
A= length $boundaryB= $self->body_raw =~ /^--\Q$boundary\E\s*$/msu
ABresult
0X0
100
111
403 unless length $boundary and $self->body_raw =~ /^--\Q$boundary\E\s*$/sm;
404  
405 41 $self->{body_raw} = $self->SUPER::body;
406  
407 # rfc1521 7.2.1
408 41 my ($body, $epilogue) = split /^--\Q$boundary\E--\s*$/sm, $self->body_raw, 2;
409  
410 41 ▶ my @bits = split /^--\Q$boundary\E\s*$/sm, ($body || '');
Condition50%1/2
$body || ''
l!l
410
MC/DC0%0/1
$body || ''
$body
Truth table50%1/2
A
A= $body
Aresult
11
00
411  
412 41 $self->SUPER::body_set(undef);
413  
414 # If there are no headers in the potential MIME part, it's just part of the
415 # body. This is a horrible hack, although it's debatable whether it was
416 # better or worse when it was $self->{body} = shift @bits ... -- rjbs,
417 # 2006-11-27
418 41 ▶ $self->SUPER::body_set(shift @bits) if index(($bits[0] || ''), ':') == -1;
Branch: 1 branch
BranchTrueFalseTotal
if index($bits[0] || "", ":") == -1 41 0 41
Condition100%2/2
$bits[0] || ''
l!l
374
MC/DC100%1/1
$bits[0] || ''
$bits[0]
Truth table100%2/2
A
A= $bits[0]
Aresult
11
00
419  
420 41 local $CUR_PARTS = $CUR_PARTS + @bits;
421 41 ▶ Carp::croak("attempted to parse a MIME message with more than $MAX_PARTS parts")
Branch: 1 branch
BranchTrueFalseTotal
if $Email::MIME::MAX_PARTS and $Email::MIME::CUR_PARTS > $Email::MIME::MAX_PARTS 0 41 41
Condition33%1/3
$Email::MIME::MAX_PARTS and $Email::MIME::CUR_PARTS > $Email::MIME::MAX_PARTS
!ll&&!rl&&r
0410
MC/DC0%0/2
$Email::MIME::MAX_PARTS and $Email::MIME::CUR_PARTS > $Email::MIME::MAX_PARTS
$Email::MIME::MAX_PARTS $Email::MIME::CUR_PARTS > $Email::MIME::MAX_PARTS
Truth table33%1/3
A and B
A= $Email::MIME::MAX_PARTSB= $Email::MIME::CUR_PARTS > $Email::MIME::MAX_PARTS
ABresult
0X0
100
111
422 if $MAX_PARTS && $CUR_PARTS > $MAX_PARTS;
423  
424 41 my @parts;
425 41 for my $bit (@bits) {
426 82 $bit =~ s/\A[\n\r]+//smg;
427 82 $bit =~ s/(?<!\x0d)$self->{mycrlf}\Z//sm;
428 82 local $DEPTH = $DEPTH + 1;
429 82 my $email = (ref $self)->_new($bit, { encode_check => $self->encode_check });
430 82 push @parts, $email;
431 }
432  
433 41 $self->{parts} = \@parts;
434  
435 41 return @{ $self->{parts} };
436 }
437  
438 55 ▶sub force_decode_hook { 0 }
Subroutine force_decode_hook: called CC=1 SCAR=0.0
Pod undocumented
439 29 ▶sub decode_hook { return $_[1] }
Subroutine decode_hook: called CC=1 SCAR=0.0
Pod documented
440 22 ▶sub content_type { scalar shift->header("Content-type"); }
Subroutine content_type: called CC=1 SCAR=0.0
Pod documented
441 164 ▶sub content_type_raw { scalar shift->header_raw("Content-type"); }
Subroutine content_type_raw: called CC=1 SCAR=0.0
Pod undocumented
442  
443 7 ▶sub debug_structure {
Subroutine debug_structure: called CC=4 SCAR=13.9
Pod documented
444 7 my ($self, $level) = @_;
445 7 ▶ $level ||= 0;
Condition100%2/2
$level ||= 0
l!l
52
MC/DC100%1/1
$level ||= 0
$level
Truth table100%2/2
A
A= $level
Aresult
11
00
446 7 my $rv = " " x (5 * $level);
447 7 ▶ $rv .= "+ " . ($self->content_type || '') . "\n";
Condition100%2/2
$self->content_type || ''
l!l
61
MC/DC100%1/1
$self->content_type || ''
$self->content_type
Truth table100%2/2
A
A= $self->content_type
Aresult
11
00
448 7 my @parts = $self->subparts;
449 7 $rv .= $_->debug_structure($level + 1) for @parts;
450 7 return $rv;
451 }
452  
453 19 my %gcache;
454  
455 5 ▶sub filename {
Subroutine filename: called CC=6 SCAR=17.9
Pod documented
456 5 my ($self, $force) = @_;
457 5 ▶ return $gcache{$self} if exists $gcache{$self};
Branch: 1 branch
BranchTrueFalseTotal
if exists $gcache{$self} 1 4 5
458  
459 4 ▶ my $dis = $self->header_raw("Content-Disposition") || '';
Condition100%2/2
$self->header_raw('Content-Disposition') || ''
l!l
13
MC/DC100%1/1
$self->header_raw('Content-Disposition') || ''
$self->header_raw('Content-Disposition')
Truth table100%2/2
A
A= $self->header_raw('Content-Disposition')
Aresult
11
00
460 4 my $attrs = parse_content_disposition($dis)->{attributes};
461 my $name = $attrs->{filename}
462 4 ▶ || $self->{ct}{attributes}{name};
Condition100%3/3
$attrs->{'filename'} || $self->{'ct'}{'attributes'}{'name'}
l!l&&r!l&&!r
112
MC/DC100%2/2
$attrs->{'filename'} || $self->{'ct'}{'attributes'}{'name'}
$attrs->{'filename'} $self->{'ct'}{'attributes'}{'name'}
Truth table100%3/3
A || B
A= $attrs->{'filename'}B= $self->{'ct'}{'attributes'}{'name'}
ABresult
1X1
011
000
463 4 ▶ return $name if $name or !$force;
Branch: 1 branch
BranchTrueFalseTotal
if $name or not $force 2 2 4
Condition66%2/3
$name or not $force
l!l&&r!l&&!r
202
MC/DC50%1/2
$name or not $force
$name not $force
Truth table66%2/3
A or not(B)
A= $nameB= not $force
ABresult
1X1
011
000
464 return $gcache{$self} = $self->invent_filename(
465 2 $self->{ct}->{type} . "/" . $self->{ct}->{subtype});
466 }
467  
468 19 my $gname = 0;
469  
470 2 ▶sub invent_filename {
Subroutine invent_filename: called CC=3 SCAR=11.6
Pod documented
471 2 my ($self, $ct) = @_;
472 2 require MIME::Types;
473 2 my $type = MIME::Types->new->type($ct);
474 2 ▶ my $ext = $type && (($type->extensions)[0]);
Condition33%1/3
$type && ($type->extensions)[0]
!ll&&!rl&&r
002
MC/DC0%0/2
$type && ($type->extensions)[0]
$type ($type->extensions)[0]
Truth table33%1/3
A && B
A= $typeB= ($type->extensions)[0]
ABresult
0X0
100
111
475 2 ▶ $ext ||= "dat";
Condition50%1/2
$ext ||= "dat"
l!l
20
MC/DC0%0/1
$ext ||= "dat"
$ext
Truth table50%1/2
A
A= $ext
Aresult
11
00
476 2 return "attachment-$$-" . $gname++ . ".$ext";
477 }
478  
479 164 ▶sub default_header_class { 'Email::MIME::Header' }
Subroutine default_header_class: called CC=1 SCAR=0.0
Pod documented
480  
481 26 ▶sub header_str {
Subroutine header_str: called CC=1 SCAR=0.0
Pod undocumented
482 26 my $self = shift;
483 26 $self->header_obj->header_str(@_);
484 }
485  
486 20 ▶sub header_str_set {
Subroutine header_str_set: called CC=1 SCAR=0.0
Pod documented
487 20 my $self = shift;
488 20 $self->header_obj->header_str_set(@_);
489 }
490  
491 1 ▶sub header_str_pairs {
Subroutine header_str_pairs: called CC=1 SCAR=0.0
Pod documented
492 1 my $self = shift;
493 1 $self->header_obj->header_str_pairs(@_);
494 }
495  
496 14 ▶sub header_as_obj {
Subroutine header_as_obj: called CC=1 SCAR=0.0
Pod documented
497 14 my $self = shift;
498 14 $self->header_obj->header_as_obj(@_);
499 }
500  
501 #pod =method content_type_set
502 #pod
503 #pod $email->content_type_set( 'text/html' );
504 #pod
505 #pod Change the content type. All C<Content-Type> header attributes
506 #pod will remain intact.
507 #pod
508 #pod =cut
509  
510 28 ▶sub content_type_set {
Subroutine content_type_set: called CC=1 SCAR=0.0
Pod documented
511 28 my ($self, $ct) = @_;
512 28 my $ct_header = parse_content_type($self->header('Content-Type'));
513 28 @{$ct_header}{qw[type subtype]} = split m[/], $ct;
514 28 $self->_compose_content_type($ct_header);
515 28 $self->_reset_cids;
516 28 return $ct;
517 }
518  
519 #pod =method charset_set
520 #pod
521 #pod =method name_set
522 #pod
523 #pod =method format_set
524 #pod
525 #pod =method boundary_set
526 #pod
527 #pod $email->charset_set( 'UTF-8' );
528 #pod $email->name_set( 'some_filename.txt' );
529 #pod $email->format_set( 'flowed' );
530 #pod $email->boundary_set( undef ); # remove the boundary
531 #pod
532 #pod These four methods modify common C<Content-Type> attributes. If set to
533 #pod C<undef>, the attribute is removed. All other C<Content-Type> header
534 #pod information is preserved when modifying an attribute.
535 #pod
536 #pod =cut
537  
538 19 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=6.9
539 19 foreach my $attr (qw[charset name format]) {
540 16 ▶ my $code = sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
541 16 my ($self, $value) = @_;
542 16 my $ct_header = parse_content_type($self->header('Content-Type'));
543 16 ▶ if ($value) {
Branch: 1 branch
BranchTrueFalseTotal
if ($value) { } 15 1 16
544 15 $ct_header->{attributes}->{$attr} = $value;
545 } else {
546 1 delete $ct_header->{attributes}->{$attr};
547 }
548 16 $self->_compose_content_type($ct_header);
549 16 return $value;
550 57 };
551  
552 19 ▶ no strict 'refs'; ## no critic strict
Subroutine BEGIN: called CC=1 SCAR=0.0
553 57 *{"$attr\_set"} = $code;
554 }
555 }
556  
557 1 ▶sub boundary_set {
Subroutine boundary_set: called CC=3 SCAR=11.6
Pod documented
558 1 my ($self, $value) = @_;
559 1 my $ct_header = parse_content_type($self->header('Content-Type'));
560  
561 1 ▶ if (length $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $value) { } 1 0 1
562 1 $ct_header->{attributes}->{boundary} = $value;
563 } else {
564 0 delete $ct_header->{attributes}->{boundary};
565 }
566 1 $self->_compose_content_type($ct_header);
567  
568 1 ▶ $self->parts_set([ $self->parts ]) if $self->parts > 1;
Branch: 1 branch
BranchTrueFalseTotal
if $self->parts > 1 0 1 1
569 }
570  
571 65 ▶sub content_type_attribute_set {
Subroutine content_type_attribute_set: called CC=5 SCAR=16.3
Pod undocumented
572 65 my ($self, $key, $value) = @_;
573 65 $key = lc $key;
574  
575 65 ▶ if ($CT_SETTER{$key}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CT_SETTER{$key}) 62 3 65
576 62 my $method = "$key\_set";
577 62 return $self->$method($value);
578 }
579  
580 3 my $ct_header = parse_content_type($self->header('Content-Type'));
581 3 my $attrs = $ct_header->{attributes};
582  
583 3 for my $existing_key (keys %$attrs) {
584 3 ▶ delete $attrs->{$existing_key} if lc $existing_key eq $key;
Branch: 1 branch
BranchTrueFalseTotal
if lc $existing_key eq $key 0 3 3
585 }
586  
587 3 ▶ if ($value) {
Branch: 1 branch
BranchTrueFalseTotal
if ($value) { } 3 0 3
588 3 $ct_header->{attributes}->{$key} = $value;
589 } else {
590 0 delete $ct_header->{attributes}->{$key};
591 }
592 3 $self->_compose_content_type($ct_header);
593 }
594  
595 #pod =method encode_check
596 #pod
597 #pod =method encode_check_set
598 #pod
599 #pod $email->encode_check;
600 #pod $email->encode_check_set(0);
601 #pod $email->encode_check_set(Encode::FB_DEFAULT);
602 #pod
603 #pod Gets/sets the current C<encode_check> setting (default: I<FB_CROAK>).
604 #pod This is the parameter passed to L<Encode/"decode"> and L<Encode/"encode">
605 #pod when C<body_str()>, C<body_str_set()>, and C<create()> are called.
606 #pod
607 #pod With the default setting, Email::MIME may crash if the claimed charset
608 #pod of a body does not match its contents (for example - utf8 data in a
609 #pod text/plain; charset=us-ascii message).
610 #pod
611 #pod With an C<encode_check> of 0, the unrecognized bytes will instead be
612 #pod replaced with the C<REPLACEMENT CHARACTER> (U+0FFFD), and may end up
613 #pod as either that or question marks (?).
614 #pod
615 #pod See L<Encode/"Handling Malformed Data"> for more information.
616 #pod
617 #pod =cut
618  
619 102 ▶sub encode_check {
Subroutine encode_check: called CC=1 SCAR=0.0
Pod documented
620 102 my ($self) = @_;
621  
622 102 return $self->{encode_check};
623 }
624  
625 164 ▶sub encode_check_set {
Subroutine encode_check_set: called CC=1 SCAR=0.0
Pod documented
626 164 my ($self, $val) = @_;
627  
628 164 return $self->{encode_check} = $val;
629 }
630  
631 #pod =method encoding_set
632 #pod
633 #pod $email->encoding_set( 'base64' );
634 #pod $email->encoding_set( 'quoted-printable' );
635 #pod $email->encoding_set( '8bit' );
636 #pod
637 #pod Convert the message body and alter the C<Content-Transfer-Encoding>
638 #pod header using this method. Your message body, the output of the C<body()>
639 #pod method, will remain the same. The raw body, output with the C<body_raw()>
640 #pod method, will be changed to reflect the new encoding.
641 #pod
642 #pod =cut
643  
644 59 ▶sub encoding_set {
Subroutine encoding_set: called CC=2 SCAR=6.9
Pod documented
645 59 my ($self, $enc) = @_;
646 59 ▶ $enc ||= '7bit';
Condition100%2/2
$enc ||= "7bit"
l!l
518
MC/DC100%1/1
$enc ||= "7bit"
$enc
Truth table100%2/2
A
A= $enc
Aresult
11
00
647 59 my $body = $self->body;
648 59 $self->header_raw_set('Content-Transfer-Encoding' => $enc);
649 59 $self->body_set($body);
650 }
651  
652 #pod =method body_set
653 #pod
654 #pod $email->body_set( $unencoded_body_string );
655 #pod
656 #pod This method will encode the new body you send using the encoding
657 #pod specified in the C<Content-Transfer-Encoding> header, then set
658 #pod the body to the new encoded body.
659 #pod
660 #pod =cut
661  
662 295 ▶sub body_set {
Subroutine body_set: called CC=7 SCAR=19.5
Pod documented
663 295 my ($self, $body) = @_;
664 295 my $body_ref;
665  
666 295 ▶ if (ref $body) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $body) { } 165 130 295
667 165 ▶ Carp::croak("provided body reference is not a scalar reference")
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::reftype($body) eq "SCALAR" 0 165 165
668 unless reftype($body) eq 'SCALAR';
669 165 $body_ref = $body;
670 } else {
671 130 $body_ref = \$body;
672 }
673 295 my $enc = $self->header('Content-Transfer-Encoding');
674  
675 # XXX: This is a disgusting hack and needs to be fixed, probably by a
676 # clearer definition and reengineering of Simple construction. The bug
677 # this fixes is an indirect result of the previous behavior in which all
678 # Simple subclasses were free to alter the guts of the Email::Simple
679 # object. -- rjbs, 2007-07-16
680 295 ▶ unless (((caller(1))[3] || '') eq 'Email::Simple::new') {
Branch: 1 branch
BranchTrueFalseTotal
unless (((caller 1)[3] || "") eq "Email::Simple::new") 131 164 295
Condition100%2/2
(caller 1)[3] || ''
l!l
2941
MC/DC100%1/1
(caller 1)[3] || ''
(caller 1)[3]
Truth table100%2/2
A
A= (caller 1)[3]
Aresult
11
00
681 131 ▶ $$body_ref = Email::MIME::Encodings::encode($enc, $$body_ref)
Branch: 1 branch
BranchTrueFalseTotal
unless not $enc or $enc =~ /$NO_ENCODE_RE/u 41 90 131
Condition100%3/3
not $enc or $enc =~ /$NO_ENCODE_RE/u
l!l&&r!l&&!r
167441
MC/DC100%2/2
not $enc or $enc =~ /$NO_ENCODE_RE/u
not $enc $enc =~ /$NO_ENCODE_RE/u
Truth table100%3/3
not(A) or B
A= not $encB= $enc =~ /$NO_ENCODE_RE/u
ABresult
1X1
011
000
682 unless !$enc || $enc =~ $NO_ENCODE_RE;
683 }
684  
685 295 $self->{body_raw} = $$body_ref;
686 295 $self->SUPER::body_set($body_ref);
687 }
688  
689 #pod =method body_str_set
690 #pod
691 #pod $email->body_str_set($unicode_str);
692 #pod
693 #pod This method behaves like C<body_set>, but assumes that the given value is a
694 #pod Unicode string that should be encoded into the message's charset
695 #pod before being set.
696 #pod
697 #pod The charset must already be set, either manually (via the C<attributes>
698 #pod argument to C<create> or C<charset_set>) or through the C<Content-Type> of a
699 #pod parsed message. If the charset can't be determined, an exception is thrown.
700 #pod
701 #pod =cut
702  
703 0 ▶sub body_str_set {
Subroutine body_str_set: not called CC=2 SCAR=17.9
Pod documented
704 0 my ($self, $body_str) = @_;
705  
706 0 my $ct = parse_content_type($self->content_type);
707 Carp::confess("body_str was given, but no charset is defined")
708 0 ▶ unless my $charset = $ct->{attributes}{charset};
Branch: 1 branch
BranchTrueFalseTotal
unless my $charset = $ct->{"attributes"}{"charset"} 0 0 0
709  
710 0 my $body_octets = Encode::encode($charset, $body_str, $self->encode_check);
711 0 $self->body_set($body_octets);
712 }
713  
714 #pod =method disposition_set
715 #pod
716 #pod $email->disposition_set( 'attachment' );
717 #pod
718 #pod Alter the C<Content-Disposition> of a message. All header attributes
719 #pod will remain intact.
720 #pod
721 #pod =cut
722  
723 8 ▶sub disposition_set {
Subroutine disposition_set: called CC=3 SCAR=11.0
Pod documented
724 8 my ($self, $dis) = @_;
725 8 ▶ $dis ||= 'inline';
Condition50%1/2
$dis ||= "inline"
l!l
80
MC/DC0%0/1
$dis ||= "inline"
$dis
Truth table50%1/2
A
A= $dis
Aresult
11
00
726 8 my $dis_header = $self->header('Content-Disposition');
727 8 ▶ $dis_header
Branch: 1 branch
BranchTrueFalseTotal
$dis_header ? : 3 5 8
728 ? ($dis_header =~ s/^([^;]+)/$dis/)
729 : ($dis_header = $dis);
730 8 $self->header_raw_set('Content-Disposition' => $dis_header);
731 }
732  
733 #pod =method filename_set
734 #pod
735 #pod $email->filename_set( 'boo.pdf' );
736 #pod
737 #pod Sets the filename attribute in the C<Content-Disposition> header. All other
738 #pod header information is preserved when setting this attribute.
739 #pod
740 #pod =cut
741  
742 4 ▶sub filename_set {
Subroutine filename_set: called CC=3 SCAR=11.0
Pod documented
743 4 my ($self, $filename) = @_;
744 4 my $dis_header = $self->header('Content-Disposition');
745 4 my ($disposition, $attrs) = ('inline', {});
746 4 ▶ if ($dis_header) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dis_header) 4 0 4
747 4 my $struct = parse_content_disposition($dis_header);
748 4 $disposition = $struct->{type};
749 4 $attrs = $struct->{attributes};
750 }
751 4 ▶ $filename ? $attrs->{filename} = $filename : delete $attrs->{filename};
Branch: 1 branch
BranchTrueFalseTotal
$filename ? : 3 1 4
752 4 my $dis = build_content_disposition({type => $disposition, attributes => $attrs});
753 4 $self->header_raw_set('Content-Disposition' => $dis);
754 }
755  
756 #pod =method parts_set
757 #pod
758 #pod $email->parts_set( \@new_parts );
759 #pod
760 #pod Replaces the parts for an object. Accepts a reference to a list of
761 #pod C<Email::MIME> objects, representing the new parts. If this message was
762 #pod originally a single part, the C<Content-Type> header will be changed to
763 #pod C<multipart/mixed>, and given a new boundary attribute.
764 #pod
765 #pod =cut
766  
767 29 ▶sub parts_set {
Subroutine parts_set: called CC=9 SCAR=22.0
Pod documented
768 29 my ($self, $parts) = @_;
769 29 my $body = q{};
770  
771 29 my $ct_header = parse_content_type($self->header('Content-Type'));
772  
773 29 ▶ if (@{$parts} > 1 or $ct_header->{type} eq 'multipart') {
Branch: 2 branches
BranchTrueFalseTotal
if (@{$parts;} > 1 or $ct_header->{'type'} eq 'multipart') { } 25 4 29
elsif (@$parts == 1) { } 4 0 4
Condition100%3/3
@{$parts;} > 1 or $ct_header->{"type"} eq "multipart"
l!l&&r!l&&!r
1784
MC/DC100%2/2
@{$parts;} > 1 or $ct_header->{"type"} eq "multipart"
@{$parts;} > 1 $ct_header->{"type"} eq "multipart"
Truth table100%3/3
A or B
A= @{$parts;} > 1B= $ct_header->{"type"} eq "multipart"
ABresult
1X1
011
000
774  
775 # setup multipart
776 $ct_header->{attributes}->{boundary} = Email::MessageID->new->user
777 25 ▶ unless length $ct_header->{attributes}->{boundary};
Branch: 1 branch
BranchTrueFalseTotal
unless length $ct_header->{"attributes"}{"boundary"} 16 9 25
778 25 my $bound = $ct_header->{attributes}->{boundary};
779 25 foreach my $part (@{$parts}) {
780 51 $body .= "$self->{mycrlf}--$bound$self->{mycrlf}";
781 51 $body .= $part->as_string;
782 }
783 25 $body .= "$self->{mycrlf}--$bound--$self->{mycrlf}";
784  
785 25 ▶ unless (grep { $ct_header->{type} eq $_ } qw[multipart message]) {
Branch: 1 branch
BranchTrueFalseTotal
unless (grep {$ct_header->{"type"} eq $_;} "multipart", "message") 10 15 25
786 10 ▶ if (scalar $self->header('Content-Type')) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar $self->header("Content-Type")) 0 10 10
787 0 Carp::carp("replacing non-multipart type ($ct_header->{type}/$ct_header->{subtype}) with multipart/mixed");
788 }
789 10 @{$ct_header}{qw[type subtype]} = qw[multipart mixed];
790 }
791  
792 25 $self->encoding_set('7bit');
793 25 delete $ct_header->{attributes}{charset};
794 } elsif (@$parts == 1) { # setup singlepart
795 4 $body .= $parts->[0]->body;
796  
797 4 my $from_ct = parse_content_type($parts->[0]->header('Content-Type'));
798 4 @{$ct_header}{qw[type subtype]} = @{ $from_ct }{qw[type subtype]};
799  
800 4 ▶ if (exists $from_ct->{attributes}{charset}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $from_ct->{'attributes'}{'charset'}) { } 2 2 4
801 2 $ct_header->{attributes}{charset} = $from_ct->{attributes}{charset};
802 } else {
803 2 delete $ct_header->{attributes}{charset};
804 }
805  
806 4 $self->encoding_set($parts->[0]->header('Content-Transfer-Encoding'));
807 4 delete $ct_header->{attributes}->{boundary};
808 }
809  
810 29 $self->_compose_content_type($ct_header);
811 29 $self->body_set($body);
812 29 $self->fill_parts;
813 29 $self->_reset_cids;
814 }
815  
816 #pod =method parts_add
817 #pod
818 #pod $email->parts_add( \@more_parts );
819 #pod
820 #pod Adds MIME parts onto the current MIME part. This is a simple extension
821 #pod of C<parts_set> to make our lives easier. It accepts an array reference
822 #pod of additional parts.
823 #pod
824 #pod =cut
825  
826 3 ▶sub parts_add {
Subroutine parts_add: called CC=1 SCAR=0.0
Pod documented
827 3 my ($self, $parts) = @_;
828 3 $self->parts_set([ $self->parts, @{$parts}, ]);
829 }
830  
831 #pod =method walk_parts
832 #pod
833 #pod $email->walk_parts(sub {
834 #pod my ($part) = @_;
835 #pod return if $part->subparts; # multipart
836 #pod
837 #pod if ( $part->content_type =~ m[text/html]i ) {
838 #pod my $body = $part->body;
839 #pod $body =~ s/<link [^>]+>//; # simple filter example
840 #pod $part->body_set( $body );
841 #pod }
842 #pod });
843 #pod
844 #pod Walks through all the MIME parts in a message and applies a callback to
845 #pod each. Accepts a code reference as its only argument. The code reference
846 #pod will be passed a single argument, the current MIME part within the
847 #pod top-level MIME object. All changes will be applied in place.
848 #pod
849 #pod =cut
850  
851 10 ▶sub walk_parts {
Subroutine walk_parts: called CC=1 SCAR=0.0
Pod documented
852 10 my ($self, $callback) = @_;
853  
854 10 my %changed;
855  
856 my $walk_weak;
857 40 ▶ my $walk = sub {
Subroutine __ANON__: called CC=9 SCAR=22.5
858 40 my ($part) = @_;
859 40 $callback->($part);
860  
861 40 ▶ if (my @orig_subparts = $part->subparts) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@orig_subparts) = $part->subparts) 14 26 40
862 14 my $differ;
863 my @subparts;
864  
865 14 for my $part (@orig_subparts) {
866 30 my $str = $part->as_string;
867 30 ▶ next unless my $new = $walk_weak->($part);
Branch: 1 branch
BranchTrueFalseTotal
unless my $new = &$walk_weak($part) 0 30 30
868 30 ▶ $differ = 1 if $str ne $new->as_string;
Branch: 1 branch
BranchTrueFalseTotal
if $str ne $new->as_string 9 21 30
869 30 push @subparts, $new;
870 }
871  
872 $differ
873 ||= (@subparts != @orig_subparts)
874 17 || (grep { $subparts[$_] != $orig_subparts[$_] } (0 .. $#subparts))
875 14 ▶ || (grep { $changed{ 0+$subparts[$_] } } (0 .. $#subparts));
Condition44%4/9
$differ ||= @subparts != @orig_subparts || grep({$subparts[$_] != $orig_subparts[$_];} 0 .. $#subparts) || grep({$changed{0 + $subparts[$_]};} 0 .. $#subparts)
l!l&&r!l&&!r
608
@subparts != @orig_subparts || grep({$subparts[$_] != $orig_subparts[$_];} 0 .. $#subparts) || grep({$changed{0 + $subparts[$_]};} 0 .. $#subparts)
l!l&&r!l&&!r
008
@subparts != @orig_subparts or grep {$subparts[$_] != $orig_subparts[$_];} 0 .. $#subparts
l!l&&r!l&&!r
008
MC/DC0%0/4
$differ ||= @subparts != @orig_subparts || grep({$subparts[$_] != $orig_subparts[$_];} 0 .. $#subparts) || grep({$changed{0 + $subparts[$_]};} 0 .. $#subparts)
$differ @subparts != @orig_subparts grep {$subparts[$_] != $orig_subparts[$_];} 0 .. $#subparts grep({$changed{0 + $subparts[$_]};} 0 .. $#subparts)
Truth table0%0/5
A ||= B or C || D
A= $differB= @subparts != @orig_subpartsC= grep {$subparts[$_] != $orig_subparts[$_];} 0 .. $#subpartsD= grep({$changed{0 + $subparts[$_]};} 0 .. $#subparts)
ABCDresult
1XXX1
01XX1
001X1
00011
00000
876  
877 14 ▶ if ($differ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($differ) 6 8 14
878 6 $part->parts_set(\@subparts);
879 6 $changed{ 0+$part }++;
880 }
881 }
882  
883 40 return $part;
884 10 };
885  
886 10 $walk_weak = $walk;
887 10 weaken $walk_weak;
888  
889 10 my $rv = $walk->($self);
890  
891 10 undef $walk;
892  
893 10 return $rv;
894 }
895  
896 77 ▶sub _compose_content_type {
Subroutine _compose_content_type: called CC=1 SCAR=0.0
897 77 my ($self, $ct_header) = @_;
898 77 my $ct = build_content_type({type => $ct_header->{type}, subtype => $ct_header->{subtype}, attributes => $ct_header->{attributes}});
899 77 $self->header_raw_set('Content-Type' => $ct);
900 77 $self->{ct} = $ct_header;
901 }
902  
903 39 ▶sub _get_cid {
Subroutine _get_cid: called CC=1 SCAR=0.0
904 39 Email::MessageID->new->address;
905 }
906  
907 57 ▶sub _reset_cids {
Subroutine _reset_cids: called CC=9 SCAR=22.0
908 57 my ($self) = @_;
909  
910 57 my $ct_header = parse_content_type($self->header('Content-Type'));
911  
912 57 ▶ if ($self->parts > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->parts > 1) 19 38 57
913 19 ▶ if ($ct_header->{subtype} eq 'alternative') {
Branch: 1 branch
BranchTrueFalseTotal
if ($ct_header->{'subtype'} eq 'alternative') { } 4 15 19
914 4 my %cids;
915 4 for my $part ($self->parts) {
916 9 ▶ my $cid = $part->header('Content-ID') // q{};
Condition100%2/2
$part->header("Content-ID") // ""
l!l
45
MC/DC100%1/1
$part->header("Content-ID") // ""
$part->header("Content-ID")
Truth table100%2/2
A
A= $part->header("Content-ID")
Aresult
11
00
917 9 $cids{$cid}++;
918 }
919 4 ▶ return if keys(%cids) == 1;
Branch: 1 branch
BranchTrueFalseTotal
if keys %cids == 1 3 1 4
920  
921 1 my $cid = $self->_get_cid;
922 1 $_->header_raw_set('Content-ID' => "<$cid>") for $self->parts;
923 } else {
924 15 foreach ($self->parts) {
925 38 my $cid = $self->_get_cid;
926 38 ▶ $_->header_raw_set('Content-ID' => "<$cid>")
Branch: 1 branch
BranchTrueFalseTotal
unless $_->header("Content-ID") 30 8 38
927 unless $_->header('Content-ID');
928 }
929 }
930 }
931 }
932  
933 19 1;
934  
935 =pod
936  
937 =encoding UTF-8
938  
939 =head1 NAME
940  
941 Email::MIME - easy MIME message handling
942  
943 =head1 VERSION
944  
945 version 1.954
946  
947 =head1 SYNOPSIS
948  
949 B<Wait!> Before you read this, maybe you just need L<Email::Stuffer>, which is
950 a much easier-to-use tool for building simple email messages that might have
951 attachments or both plain text and HTML. If that doesn't do it for you, then
952 by all means keep reading.
953  
954 use Email::MIME;
955 my $parsed = Email::MIME->new($message);
956  
957 my @parts = $parsed->parts; # These will be Email::MIME objects, too.
958 my $decoded = $parsed->body;
959 my $non_decoded = $parsed->body_raw;
960  
961 my $content_type = $parsed->content_type;
962  
963 ...or...
964  
965 use Email::MIME;
966 use IO::All;
967  
968 # multipart message
969 my @parts = (
970 Email::MIME->create(
971 attributes => {
972 filename => "report.pdf",
973 content_type => "application/pdf",
974 encoding => "quoted-printable",
975 name => "2004-financials.pdf",
976 },
977 body => io( "2004-financials.pdf" )->binary->all,
978 ),
979 Email::MIME->create(
980 attributes => {
981 content_type => "text/plain",
982 disposition => "attachment",
983 charset => "US-ASCII",
984 },
985 body_str => "Hello there!",
986 ),
987 );
988  
989 my $email = Email::MIME->create(
990 header_str => [
991 From => 'casey@geeknest.com',
992 To => [ 'user1@host.com', 'Name <user2@host.com>' ],
993 Cc => Email::Address::XS->new("Display Name \N{U+1F600}", 'user@example.com'),
994 ],
995 parts => [ @parts ],
996 );
997  
998 # nesting parts
999 $email->parts_set(
1000 [
1001 $email->parts,
1002 Email::MIME->create( parts => [ @parts ] ),
1003 ],
1004 );
1005  
1006 # standard modifications
1007 $email->header_str_set( 'X-PoweredBy' => 'RT v3.0' );
1008 $email->header_str_set( To => rcpts() );
1009 $email->header_str_set( Cc => aux_rcpts() );
1010 $email->header_str_set( Bcc => sekrit_rcpts() );
1011  
1012 # more advanced
1013 $_->encoding_set( 'base64' ) for $email->parts;
1014  
1015 # Quick multipart creation
1016 my $email = Email::MIME->create(
1017 header_str => [
1018 From => 'my@address',
1019 To => 'your@address',
1020 ],
1021 parts => [
1022 q[This is part one],
1023 q[This is part two],
1024 q[These could be binary too],
1025 ],
1026 );
1027  
1028 print $email->as_string;
1029  
1030 =head1 DESCRIPTION
1031  
1032 This is an extension of the L<Email::Simple> module, to handle MIME
1033 encoded messages. It takes a message as a string, splits it up into its
1034 constituent parts, and allows you access to various parts of the
1035 message. Headers are decoded from MIME encoding.
1036  
1037 =head1 PERL VERSION
1038  
1039 This library should run on perls released even a long time ago. It should
1040 work on any version of perl released in the last five years.
1041  
1042 Although it may work on older versions of perl, no guarantee is made that the
1043 minimum required version will not be increased. The version may be increased
1044 for any reason, and there is no promise that patches will be accepted to
1045 lower the minimum required perl.
1046  
1047 =head1 METHODS
1048  
1049 Please see L<Email::Simple> for the base set of methods. It won't take
1050 very long. Added to that, you have:
1051  
1052 =head2 create
1053  
1054 my $single = Email::MIME->create(
1055 header_str => [ ... ],
1056 body_str => '...',
1057 attributes => { ... },
1058 );
1059  
1060 my $multi = Email::MIME->create(
1061 header_str => [ ... ],
1062 parts => [ ... ],
1063 attributes => { ... },
1064 );
1065  
1066 This method creates a new MIME part. The C<header_str> parameter is a list of
1067 headers pairs to include in the message. The value for each pair is expected to
1068 be a text string that will be MIME-encoded as needed. Alternatively it can be
1069 an object with C<as_mime_string> method which implements conversion of that
1070 object to MIME-encoded string. That object method is called with two named
1071 input parameters: C<charset> and C<header_name_length>. It should return
1072 MIME-encoded representation of the object. As of 2017-07-25, the
1073 header-value-as-object code is very young, and may yet change.
1074  
1075 In case header name is registered in C<%Email::MIME::Header::header_to_class_map>
1076 hash then registered class is used for conversion from Unicode string to 8bit
1077 MIME encoding. Value can be either string or array reference to strings.
1078 Object is constructed via method C<from_string> with string value (or values
1079 in case of array reference) and converted to MIME-encoded string via
1080 C<as_mime_string> method.
1081  
1082 A similar C<header> parameter can be provided in addition to or instead of
1083 C<header_str>. Its values will be used verbatim.
1084  
1085 C<attributes> is a hash of MIME attributes to assign to the part, and may
1086 override portions of the header set in the C<header> parameter. The hash keys
1087 correspond directly to methods for modifying a message. The allowed keys are:
1088 content_type, charset, name, format, boundary, encoding, disposition, and
1089 filename. They will be mapped to C<"$attr\_set"> for message modification.
1090  
1091 The C<parts> parameter is a list reference containing C<Email::MIME>
1092 objects. Elements of the C<parts> list can also be a non-reference
1093 string of data. In that case, an C<Email::MIME> object will be created
1094 for you. Simple checks will determine if the part is binary or not, and
1095 all parts created in this fashion are encoded with C<base64>, just in case.
1096  
1097 If C<body> is given instead of C<parts>, it specifies the body to be used for a
1098 flat (subpart-less) MIME message. It is assumed to be a sequence of octets.
1099  
1100 If C<body_str> is given instead of C<body> or C<parts>, it is assumed to be a
1101 character string to be used as the body. If you provide a C<body_str>
1102 parameter, you B<must> provide C<charset> and C<encoding> attributes.
1103  
1104 =head2 content_type_set
1105  
1106 $email->content_type_set( 'text/html' );
1107  
1108 Change the content type. All C<Content-Type> header attributes
1109 will remain intact.
1110  
1111 =head2 charset_set
1112  
1113 =head2 name_set
1114  
1115 =head2 format_set
1116  
1117 =head2 boundary_set
1118  
1119 $email->charset_set( 'UTF-8' );
1120 $email->name_set( 'some_filename.txt' );
1121 $email->format_set( 'flowed' );
1122 $email->boundary_set( undef ); # remove the boundary
1123  
1124 These four methods modify common C<Content-Type> attributes. If set to
1125 C<undef>, the attribute is removed. All other C<Content-Type> header
1126 information is preserved when modifying an attribute.
1127  
1128 =head2 encode_check
1129  
1130 =head2 encode_check_set
1131  
1132 $email->encode_check;
1133 $email->encode_check_set(0);
1134 $email->encode_check_set(Encode::FB_DEFAULT);
1135  
1136 Gets/sets the current C<encode_check> setting (default: I<FB_CROAK>).
1137 This is the parameter passed to L<Encode/"decode"> and L<Encode/"encode">
1138 when C<body_str()>, C<body_str_set()>, and C<create()> are called.
1139  
1140 With the default setting, Email::MIME may crash if the claimed charset
1141 of a body does not match its contents (for example - utf8 data in a
1142 text/plain; charset=us-ascii message).
1143  
1144 With an C<encode_check> of 0, the unrecognized bytes will instead be
1145 replaced with the C<REPLACEMENT CHARACTER> (U+0FFFD), and may end up
1146 as either that or question marks (?).
1147  
1148 See L<Encode/"Handling Malformed Data"> for more information.
1149  
1150 =head2 encoding_set
1151  
1152 $email->encoding_set( 'base64' );
1153 $email->encoding_set( 'quoted-printable' );
1154 $email->encoding_set( '8bit' );
1155  
1156 Convert the message body and alter the C<Content-Transfer-Encoding>
1157 header using this method. Your message body, the output of the C<body()>
1158 method, will remain the same. The raw body, output with the C<body_raw()>
1159 method, will be changed to reflect the new encoding.
1160  
1161 =head2 body_set
1162  
1163 $email->body_set( $unencoded_body_string );
1164  
1165 This method will encode the new body you send using the encoding
1166 specified in the C<Content-Transfer-Encoding> header, then set
1167 the body to the new encoded body.
1168  
1169 =head2 body_str_set
1170  
1171 $email->body_str_set($unicode_str);
1172  
1173 This method behaves like C<body_set>, but assumes that the given value is a
1174 Unicode string that should be encoded into the message's charset
1175 before being set.
1176  
1177 The charset must already be set, either manually (via the C<attributes>
1178 argument to C<create> or C<charset_set>) or through the C<Content-Type> of a
1179 parsed message. If the charset can't be determined, an exception is thrown.
1180  
1181 =head2 disposition_set
1182  
1183 $email->disposition_set( 'attachment' );
1184  
1185 Alter the C<Content-Disposition> of a message. All header attributes
1186 will remain intact.
1187  
1188 =head2 filename_set
1189  
1190 $email->filename_set( 'boo.pdf' );
1191  
1192 Sets the filename attribute in the C<Content-Disposition> header. All other
1193 header information is preserved when setting this attribute.
1194  
1195 =head2 parts_set
1196  
1197 $email->parts_set( \@new_parts );
1198  
1199 Replaces the parts for an object. Accepts a reference to a list of
1200 C<Email::MIME> objects, representing the new parts. If this message was
1201 originally a single part, the C<Content-Type> header will be changed to
1202 C<multipart/mixed>, and given a new boundary attribute.
1203  
1204 =head2 parts_add
1205  
1206 $email->parts_add( \@more_parts );
1207  
1208 Adds MIME parts onto the current MIME part. This is a simple extension
1209 of C<parts_set> to make our lives easier. It accepts an array reference
1210 of additional parts.
1211  
1212 =head2 walk_parts
1213  
1214 $email->walk_parts(sub {
1215 my ($part) = @_;
1216 return if $part->subparts; # multipart
1217  
1218 if ( $part->content_type =~ m[text/html]i ) {
1219 my $body = $part->body;
1220 $body =~ s/<link [^>]+>//; # simple filter example
1221 $part->body_set( $body );
1222 }
1223 });
1224  
1225 Walks through all the MIME parts in a message and applies a callback to
1226 each. Accepts a code reference as its only argument. The code reference
1227 will be passed a single argument, the current MIME part within the
1228 top-level MIME object. All changes will be applied in place.
1229  
1230 =head2 header
1231  
1232 B<Achtung!> Beware this method! In Email::MIME, it means the same as
1233 C<header_str>, but on an Email::Simple object, it means C<header_raw>. Unless
1234 you always know what kind of object you have, you could get one of two
1235 significantly different behaviors.
1236  
1237 Try to use either C<header_str> or C<header_raw> as appropriate.
1238  
1239 =head2 header_str_set
1240  
1241 $email->header_str_set($header_name => @value_strings);
1242  
1243 This behaves like C<header_raw_set>, but expects Unicode (character) strings as
1244 the values to set, rather than pre-encoded byte strings. It will encode them
1245 as MIME encoded-words if they contain any control or 8-bit characters.
1246  
1247 Alternatively, values can be objects with C<as_mime_string> method. Same as in
1248 method C<create>.
1249  
1250 =head2 header_str_pairs
1251  
1252 my @pairs = $email->header_str_pairs;
1253  
1254 This method behaves like C<header_raw_pairs>, returning a list of field
1255 name/value pairs, but the values have been decoded to character strings, when
1256 possible.
1257  
1258 =head2 header_as_obj
1259  
1260 my $first_obj = $email->header_as_obj($field);
1261 my $nth_obj = $email->header_as_obj($field, $index);
1262 my @all_objs = $email->header_as_obj($field);
1263  
1264 my $nth_obj_of_class = $email->header_as_obj($field, $index, $class);
1265 my @all_objs_of_class = $email->header_as_obj($field, undef, $class);
1266  
1267 This method returns an object representation of the header value. It instances
1268 new object via method C<from_mime_string> of specified class. Input argument
1269 for that class method is list of the raw MIME-encoded values. If class argument
1270 is not specified then class name is taken from the hash
1271 C<%Email::MIME::Header::header_to_class_map> via key field. Use class method
1272 C<< Email::MIME::Header->set_class_for_header($class, $field) >> for adding new
1273 mapping.
1274  
1275 =head2 parts
1276  
1277 This returns a list of C<Email::MIME> objects reflecting the parts of the
1278 message. If it's a single-part message, you get the original object back.
1279  
1280 In scalar context, this method returns the number of parts.
1281  
1282 This is a stupid method. Don't use it.
1283  
1284 =head2 subparts
1285  
1286 This returns a list of C<Email::MIME> objects reflecting the parts of the
1287 message. If it's a single-part message, this method returns an empty list.
1288  
1289 In scalar context, this method returns the number of subparts.
1290  
1291 =head2 body
1292  
1293 This decodes and returns the body of the object I<as a byte string>. For
1294 top-level objects in multi-part messages, this is highly likely to be something
1295 like "This is a multi-part message in MIME format."
1296  
1297 =head2 body_str
1298  
1299 This decodes both the Content-Transfer-Encoding layer of the body (like the
1300 C<body> method) as well as the charset encoding of the body (unlike the C<body>
1301 method), returning a Unicode string.
1302  
1303 If the charset is known, it is used. If there is no charset but the content
1304 type is either C<text/plain> or C<text/html>, us-ascii is assumed. Otherwise,
1305 an exception is thrown.
1306  
1307 =head2 body_raw
1308  
1309 This returns the body of the object, but doesn't decode the transfer encoding.
1310  
1311 =head2 decode_hook
1312  
1313 This method is called before the L<Email::MIME::Encodings> C<decode> method, to
1314 decode the body of non-binary messages (or binary messages, if the
1315 C<force_decode_hook> method returns true). By default, this method does
1316 nothing, but subclasses may define behavior.
1317  
1318 This method could be used to implement the decryption of content in secure
1319 email, for example.
1320  
1321 =head2 content_type
1322  
1323 This is a shortcut for access to the content type header.
1324  
1325 =head2 filename
1326  
1327 This provides the suggested filename for the attachment part. Normally
1328 it will return the filename from the headers, but if C<filename> is
1329 passed a true parameter, it will generate an appropriate "stable"
1330 filename if one is not found in the MIME headers.
1331  
1332 =head2 invent_filename
1333  
1334 my $filename = Email::MIME->invent_filename($content_type);
1335  
1336 This routine is used by C<filename> to generate filenames for attached files.
1337 It will attempt to choose a reasonable extension, falling back to F<dat>.
1338  
1339 =head2 debug_structure
1340  
1341 my $description = $email->debug_structure;
1342  
1343 This method returns a string that describes the structure of the MIME entity.
1344 For example:
1345  
1346 + multipart/alternative; boundary="=_NextPart_2"; charset="BIG-5"
1347 + text/plain
1348 + text/html
1349  
1350 =head1 CONFIGURATION
1351  
1352 The variable C<$Email::MIME::MAX_DEPTH> is the maximum depth of parts that will
1353 be processed. It defaults to 10, already higher than legitimate mail is ever
1354 likely to be. This value may go up over time as the parser is improved.
1355  
1356 The variable C<$Email::MIME::MAX_PARTS> is the maximum number of parts that
1357 will be processed. It defaults to 100, already higher than legitimate mail is
1358 ever likely to be. This value may go up over time as the parser is improved or
1359 as research suggests that our starting position was wrong.
1360  
1361 Increasing either of these variables risks significant consumption of memory.
1362 Test before changing things.
1363  
1364 =head1 SEE ALSO
1365  
1366 L<Email::Simple>
1367  
1368 =head1 THANKS
1369  
1370 This module was generously sponsored by Best Practical
1371 (http://www.bestpractical.com/), Pete Sergeant, and Pobox.com.
1372  
1373 =head1 AUTHORS
1374  
1375 =over 4
1376  
1377 =item *
1378  
1379 Ricardo SIGNES <cpan@semiotic.systems>
1380  
1381 =item *
1382  
1383 Casey West <casey@geeknest.com>
1384  
1385 =item *
1386  
1387 Simon Cozens <simon@cpan.org>
1388  
1389 =back
1390  
1391 =head1 CONTRIBUTORS
1392  
1393 =for stopwords Alex Vandiver Anirvan Chatterjee Arthur Axel 'fREW' Schmidt Brian Cassidy Damian Lukowski Dan Book David Steinbrunner Dotan Dimet dxdc Eric Wong Geraint Edwards ivulfson Jesse Luehrs Kurt Anderson Lance A. Brown Matthew Horsfall memememomo Michael McClimon Mishrakk Pali Ricardo Signes Shawn Sorichetti Tomohiro Hosaka
1394  
1395 =over 4
1396  
1397 =item *
1398  
1399 Alex Vandiver <alexmv@mit.edu>
1400  
1401 =item *
1402  
1403 Anirvan Chatterjee <anirvan@users.noreply.github.com>
1404  
1405 =item *
1406  
1407 Arthur Axel 'fREW' Schmidt <frioux@gmail.com>
1408  
1409 =item *
1410  
1411 Brian Cassidy <bricas@cpan.org>
1412  
1413 =item *
1414  
1415 Damian Lukowski <damian.lukowski@credativ.de>
1416  
1417 =item *
1418  
1419 Dan Book <grinnz@gmail.com>
1420  
1421 =item *
1422  
1423 David Steinbrunner <dsteinbrunner@pobox.com>
1424  
1425 =item *
1426  
1427 Dotan Dimet <dotan@corky.net>
1428  
1429 =item *
1430  
1431 dxdc <dan@element26.net>
1432  
1433 =item *
1434  
1435 Eric Wong <e@80x24.org>
1436  
1437 =item *
1438  
1439 Geraint Edwards <gedge-oss@yadn.org>
1440  
1441 =item *
1442  
1443 ivulfson <9122139+ivulfson@users.noreply.github.com>
1444  
1445 =item *
1446  
1447 Jesse Luehrs <doy@tozt.net>
1448  
1449 =item *
1450  
1451 Kurt Anderson <kboth@drkurt.com>
1452  
1453 =item *
1454  
1455 Lance A. Brown <lance@bearcircle.net>
1456  
1457 =item *
1458  
1459 Matthew Horsfall <wolfsage@gmail.com>
1460  
1461 =item *
1462  
1463 memememomo <memememomo@gmail.com>
1464  
1465 =item *
1466  
1467 Michael McClimon <michael@mcclimon.org>
1468  
1469 =item *
1470  
1471 Mishrakk <48946018+Mishrakk@users.noreply.github.com>
1472  
1473 =item *
1474  
1475 Pali <pali@cpan.org>
1476  
1477 =item *
1478  
1479 Ricardo Signes <rjbs@semiotic.systems>
1480  
1481 =item *
1482  
1483 Ricardo Signes <rjbs@users.noreply.github.com>
1484  
1485 =item *
1486  
1487 Shawn Sorichetti <ssoriche@coloredblocks.com>
1488  
1489 =item *
1490  
1491 Tomohiro Hosaka <bokutin@bokut.in>
1492  
1493 =back
1494  
1495 =head1 COPYRIGHT AND LICENSE
1496  
1497 This software is copyright (c) 2004 by Simon Cozens and Casey West.
1498  
1499 This is free software; you can redistribute it and/or modify it under
1500 the same terms as the Perl 5 programming language system itself.
1501  
1502 =cut
1503  
1504 __END__
↑ Summary MIME/Header/AddressList.pm »