Branch Coverage

blib/lib/MIME/Mini.pm
Criterion Covered Total %
branch 261 336 77.6


line true false branch
37 30 6 unless exists $mail->{'header'} and exists $mail->{'header'}{'content-type'} or defined $parent and exists $parent->{'mime_type'} and $parent->{'mime_type'} =~ m[^multipart/digest$]iu
38 130 6 exists $mail->{'header'} && exists $mail->{'header'}{'content-type'} ? :
40 62 74 if $type =~ m[^multipart/]iu
41 54 82 unless defined $type and $type =~ m[^multipart/]iu && $boundary || $type =~ m[^message/rfc822$]iu
42 62 20 if $boundary
44 20 62 if $type =~ m[^message/(?:rfc822|external-body)$]iu
56 146 726 if (/^--\Q$mail->{'mime_boundary'}\E(--)?/u)
58 62 84 if ($state eq 'preamble') { }
84 0 elsif ($state eq 'part') { }
61 46 16 if length $text
65 54 30 if defined $1 and $1 eq "--"
75 6 56 if $state eq "part" and length $text
76 16 46 if $state eq "epilogue" and length $text
85 2 108 unless @lines
98 68 2298 if (not defined $parent and /^From (?:\S+\s+)?\s*[a-zA-Z]+\s+[a-zA-Z]+\s+\d{1,2}\s+\d{2}:\d{2}:\d{2}\s+(?:[A-Z]+\s+)?\d{4}/u)
100 46 0 if $mail and exists $mail->{'mbox'} and exists $mail->{'body'}
101 46 22 if $mail
105 950 1348 if ($state eq 'header') { }
1348 0 elsif ($state eq 'body') { }
107 682 268 if (/^([\w-]+):/u) { }
174 94 elsif (/^$/u) { }
118 94 0 if defined $last
119 94 0 if defined $last
124 912 436 if exists $mail->{'mbox'}
129 20 2 if $mail and exists $mail->{'mbox'} and exists $mail->{'body'}
130 132 8 if $mail
137 88 184 if exists $mail->{'mbox'}
138 230 42 if exists $mail->{'headers'}
140 158 114 if exists $mail->{'body'}
141 38 234 if exists $mail->{'mime_preamble'}
142 2 270 if exists $mail->{'mime_boundary'} and not exists $mail->{'mime_parts'}
143 70 202 if exists $mail->{'mime_parts'}
144 72 200 if exists $mail->{'mime_boundary'}
145 16 256 if exists $mail->{'mime_epilogue'}
146 34 238 if exists $mail->{'mime_message'}
147 88 184 if exists $mail->{'mbox'}
155 12 12 if exists $m->{'mime_type'} and $m->{'mime_type'} =~ m[^multipart/]iu
158 8 4 if exists $m->{'body'}
159 4 8 if exists $m->{'mime_message'}
160 4 8 if exists $m->{'mime_type'}
162 0 12 exists $m->{'mime_prev_boundary'} ? :
163 0 12 if exists $m->{'mime_prev_preamble'}
164 0 12 if exists $m->{'mime_prev_epilogue'}
166 4 8 unless exists $m->{'header'} and exists $m->{'header'}{'mime-version'}
175 4 36 if exists $m->{'mime_type'} and $m->{'mime_type'} =~ m[^message/]iu
176 4 16 unless exists $m->{'mime_type'} and $m->{'mime_type'} =~ m[^multipart/]iu and @{$m->{'mime_parts'};} <= 1
178 16 0 if exists $m->{'mime_boundary'}
179 8 8 if exists $m->{'mime_preamble'}
180 0 16 if exists $m->{'mime_epilogue'}
181 10 6 if exists $p->{'body'}
182 2 14 if exists $p->{'mime_message'}
183 6 10 if exists $p->{'mime_type'}
184 4 12 if exists $p->{'mime_parts'}
185 4 12 if exists $p->{'mime_boundary'}
186 0 16 if exists $p->{'mime_preamble'}
187 0 16 if exists $p->{'mime_epilogue'}
191 2 14 unless $explicit
198 38 20 if exists $m->{'mbox'}
200 20 0 unless defined $f
201 20 0 if defined $f
202 0 20 unless defined $f
230 0 6 $seen ? :
6 14 /^\Q$n\E:/iu ? :
238 2 44 unless exists $m->{'header'}
241 2 6 if ($r and exists $m->{'mime_parts'})
242 2 6 if ($r and exists $m->{'mime_message'})
272 102 257 unless exists $m->{'header'} and exists $m->{'header'}{lc $h}
279 0 2 unless exists $m->{'headers'}
286 0 2 unless exists $m->{'header'}
297 19 10 lc $2 eq 'q' ? :
29 0 defined &Encode::find_encoding($1) ? :
299 399 126 unless /^".*"$/u
306 54 33 if not defined $s or $s =~ /^[\x00-\x7f]*$/u
308 1 32 if defined eval { do { &Encode::decode("UTF-8", $s, 1) } }
309 0 32 defined $ENV{'LANG'} && $ENV{'LANG'} =~ /^.+\.(.+)$/u && $1 ne 'UTF-8' ? :
316 1 328 if grep {ord $_ > 255;} split(//u, $h, 0)
317 0 6 $l ? :
0 13 $l ? :
4 7 tr[!*+\-/-9A-Za-z]<\000- "-),.:-@[-`{-\377>c > length($_) >> 1 ? :
1012 11 !tr/\200-\377// ? :
0 1023 /^".*"$/u ? :
46 347 /^[^\s"]*".*"[^\s"]*$/u ? :
318 46 347 /^\S*".*"\S*$/u ? :
45 978 $lf && $lf + ($lf ? 1 : 0) + length($_) - $p > 78 ? :
694 329 $f ? :
332 50 48 if $v =~ /^".*"$/u
333 8 90 if $v =~ s/^(?:us-ascii|utf-8|iso-8859-\d{1,2})'\w+'//iu
334 16 82 if $decode and substr($n, -1) eq "*"
346 2 98 if defined $e and not $e =~ /^(?:[78]bit|binary|quoted-printable|base64)$/iu
348 76 22 if defined $type and $type =~ m[^((?:text|image|audio|video|application|message|multipart)/[^\s;]+)]iu
349 2 0 if not defined $type and defined $p and exists $p->{'mime_type'} and $p->{'mime_type'} =~ m[^multipart/digest]iu
357 4 6 exists $m->{'body'} && $m->{'body'} =~ tr/\200-\377// ? :
12 10 defined $e && $e =~ /^([78]bit|binary|quoted-printable|base64)$/iu ? :
372 4 4 exists $m->{'body'} ? :
378 2 4 exists $m->{'mime_message'} ? :
384 6 4 exists $m->{'mime_parts'} ? :
10 2 unless defined $p
393 4 42 $high || $ctrl ? :
394 4 42 if $enc and not $c
395 2 44 if $c and not $l
396 4 42 if $enc
400 40 6 if @p == 1
412 2 0 if (exists $a{'filename'} and not exists $a{'body'} and not exists $a{'message'} and not exists $a{'parts'} and -r $a{'filename'} and stat $a{'filename'} and open my $fh, "<", $a{'filename'})
415 0 2 exists $a{'created'} ? :
416 0 2 exists $a{'modified'} ? :
417 0 2 exists $a{'read'} ? :
420 10 54 if $a{'filename'}
421 6 58 $multi ? :
425 160 160 if $_ % 2 == 0
426 30 34 if grep {/^(?:date|from|sender|reply-to)$/iu;} keys %a and not grep({/^date$/iu;} keys %a)
427 30 34 if grep {/^(?:date|from|sender|reply-to)$/iu;} keys %a and not grep({/^mime-version$/u;} keys %a)
428 30 34 if grep {/^(?:date|from|sender|reply-to)$/iu;} keys %a and not grep({/^message-id$/iu;} keys %a)
429 6 22 $bound ? :
18 10 $char =~ /^us-ascii$/iu ? :
28 36 unless $type =~ m[^text/plain$]iu and $char =~ /^us-ascii$/iu
430 20 44 unless $enc =~ /^7bit$/iu
431 10 0 $a{'filename'} ? :
2 8 $a{'size'} ? :
2 8 $a{'created'} ? :
2 8 $a{'modified'} ? :
2 8 $a{'read'} ? :
0 54 if $a{'filename'} or $a{'size'} or $a{'created'} or $a{'modified'} or $a{'read'}
434 6 58 if $multi
435 12 52 if $msg
436 46 18 unless $multi or $msg
437 0 0 if exists $a{'mbox'} and defined $a{'mbox'} and length $a{'mbox'}
444 0 2 $e =~ /^quoted-printable$/iu ? :
2 2 $e =~ /^base64$/iu ? :
450 12 26 $e =~ /^quoted-printable$/iu ? :
8 38 $e =~ /^base64$/iu ? :
462 38 0 if $next - $pos > $maxlen
465 8 38 if $len - $pos > $maxlen
466 0 10 $len > 1024 && $high > $len * 0.167 ? :
2 26 $maxlen > 998 ? :
10 28 $high ? :
8 38 $ctrl ? :
475 12 2 if $padlen
493 0 25 Deparse error: Can't locate object method "unctrl" via package "" (perhaps you forgot to load ""?) at /usr/local/lib/perl5/5.26.1/B/Deparse.pm line 5203. ? :
495 13 12 if $qcode
510 19 0 if $qcode
553 60 2 if $add_mimetypes++
554 2 0 unless open my $fh, "<", "/etc/mime.types"
558 0 0 unless $_
559 0 0 unless $ext
569 2 60 unless exists $m->{'mime_type'} and $m->{'mime_type'} =~ m[^multipart/]iu and exists $m->{'mime_parts'}
571 2 88 mimetype($_) =~ m[^application/ms-tnef]iu && filename($_) =~ /winmail\.dat$/iu ? :
590 2 12 unless defined $type and $type == MESSAGE()
593 2 10 if $pos + $len > length $data
597 0 10 unless $chk == $tot
604 2 0 unless defined $type and $type == MESSAGE()
606 0 0 unless $id == MESSAGE_CLASS()
608 0 0 if $pos + $len > length $data
612 0 0 unless $chk == $tot
618 2 0 unless defined $type and $type == ATTACHMENT()
620 0 0 if $id == ATTACH_RENDDATA() and @attachment and not exists $attachment->{'body'}
621 0 0 if $id == ATTACH_RENDDATA()
623 0 0 if $pos + $len > length $data
627 0 0 unless $chk == $tot
628 0 0 if $id == ATTACH_DATA()
629 0 0 if $id == ATTACH_FILENAME() and not exists $attachment->{'filename'}
630 0 0 if $id == ATTACH_ATTACHMENT() and $fname = realname($buf)
632 0 0 if $id == ATTACH_MODIFIED()
639 0 0 unless $pos >= 0
641 0 0 unless my $name = substr($buf, $pos, $len)
650 0 2 unless $signature == 574529400
653 0 2 unless $type == MESSAGE() or $type == ATTACHMENT()
658 0 2 if @attachment and not exists $attachment->{'body'}
659 2 0 $badtnef ? :