Branch Coverage

blib/lib/MIME/Entity.pm
Criterion Covered Total %
branch 151 234 64.5


line true false branch
284 59 6 unless $KnownField{$field}
367 123 0 unless defined $index
370 123 0 if $index < 0
552 29 0 unless ref $self
563 5 24 exists $params{'Top'} ? :
569 6 23 exists $params{'Filename'} ? :
570 0 29 if defined $filename and $filename eq ''
573 5 24 if ($type =~ m[^(multipart/|message/(rfc822|partial|external-body|delivery-status|disposition-notification|feedback-report)$)]i)
574 2 3 unless $encoding =~ /^(|7bit|8bit|binary|-suggest)$/i
579 3 24 if ($is_multipart) { }
582 0 3 if (defined($boundary = $params{'Boundary'}))
583 0 0 if ($boundary eq '') { }
0 0 elsif ($boundary =~ m[[^0-9a-zA-Z_\'\(\)\+\,\.\/\:\=\?\- ]]) { }
594 3 0 unless defined $boundary
598 14 10 if ($params{'Path'}) { }
10 0 elsif (defined $params{'Data'}) { }
609 6 18 unless textual_type($type)
623 1 26 if $charset
624 17 10 if defined $filename
625 3 24 if defined $boundary
630 22 5 if (not $encoding) { }
3 2 elsif (lc $encoding eq '-suggest') { }
638 24 3 unless ($is_multipart)
641 17 7 if defined $filename
646 27 0 if $encoding
647 0 27 if $desc
652 2 25 if (defined $id)
653 1 1 unless ($id =~ /^<.*>$/)
658 22 5 if $top
661 22 5 if $top
670 2 65 if ($tag =~ /^-(.*)/s) { }
0 65 elsif ($tag =~ /(.*):$/s) { }
6 59 elsif (known_field(lc $tag)) { }
677 0 8 ref $value ? :
678 0 8 unless defined $value and $value ne ''
708 0 20 unless ref $self->{$_}
711 4 3 $self->bodyhandle ? :
715 2 12 if $self->{$_}
770 0 3 if (@_ > 1) { }
774 0 3 unless my $fh = 'IO::File'->new(\$output, '>:')
821 164 439 if @_ > 1
858 0 282 if @_
859 0 282 $self->{'ME_EffType'} ? :
879 38 13 if @_ > 1
900 198 1550 if @_ > 1
923 0 28 unless $self->head
925 14 14 $type eq 'multipart' ? :
945 0 0 wantarray ? :
0 361 unless $self->head
964 68 0 if $self->bodyhandle
1011 5 206 if ref $_[0]
1012 106 100 @_ ? :
1050 42 16 if @_ > 1
1126 5 2 if $self->is_multipart and not $force
1171 0 1 unless $self->is_multipart
1172 0 1 if $self->parts > 1
1180 0 1 if ($self->parts == 1) { }
1194 0 0 if $self->is_multipart
1233 3 1 if $self->bodyhandle
1252 2 23 if ($body->[$line] =~ /\A--[ \040][\r\n]+\Z/)
1293 2 1 if ($self->is_multipart)
1295 1 1 if ($first_part)
1302 0 1 unless textual_type($self->head->mime_type)
1306 0 1 unless $self->bodyhandle
1387 3 3 if ($self->is_multipart and not $params{'Attach'})
1393 0 3 if (defined($sig = $params{'Signature'})) { }
3 0 elsif ($params{'File'}) { }
1394 0 0 ref $sig ? :
1397 0 3 unless my $fh = 'IO::File'->new($params{'File'})
1399 0 3 unless $fh->close
1406 0 3 if ($params{'Attach'}) { }
1416 0 0 unless $self->head->mime_type =~ m[text/]i or $params{'Force'}
1420 0 3 unless $self->bodyhandle
1424 3 0 if (not defined $params{'Remove'} or $params{'Remove'} > 0)
1430 0 3 unless $io = $self->open('w')
1432 0 3 unless ($body[-1] || '') =~ /\n\Z/
1434 0 3 unless $io->close
1467 2 1 if ($type eq 'text' or $type eq 'message') { }
1468 0 0 $self->parts ? :
0 2 unless $self->bodyhandle
1470 2 0 if ($IO = $self->bodyhandle->open('r'))
1474 1 5 if $unclean = length $_ > 999 || /[\200-\377]/
1479 0 1 $type eq 'message' ? :
1 1 $unclean ? :
1485 0 1 $type eq 'multipart' ? :
1492 18 4 $type =~ /^(text|message|multipart)$/ ? :
1549 1 4 int(@_) % 2 == 0 ? :
1560 5 0 if ($o_nonstandard eq 'ERASE')
1563 0 19 if ($tag =~ /\AContent-/i and not $tag =~ /\AContent-$StandardFields\Z/io)
1571 5 0 if ($o_length eq 'COMPUTE') { }
0 0 elsif ($o_length eq 'ERASE') { }
1575 1 4 if ($self->is_multipart) { }
1581 4 0 unless ($ENCBODY)
1604 0 4 unless $part->sync_headers($opts)
1662 0 0 unless $fh
1663 0 0 unless defined $indent
1674 0 0 $self->bodyhandle ? :
1679 0 0 if $filename
1683 0 0 unless defined $subj
1685 0 0 if $subj
1689 0 0 if @parts
1767 1 58 if @_ < 2
1768 8 51 unless ref $out
1814 10 65 if ($type eq 'multipart') { }
0 65 elsif ($self->parts) { }
1819 9 1 if (defined $plines) { }
1822 2 7 if @$plines > 0
1838 1 9 unless $self->epilogue
1839 1 9 if ($epilogue ne '')
1841 0 1 unless $epilogue =~ /\n\Z/
1852 0 0 if $need_sep++
1859 65 0 $self->bodyhandle ? :
1879 7 58 if ($self->bodyhandle->is_encoded) { }
1889 52 6 textual_type($self->head->mime_type) ? :
0 58 unless $decoder->encode($IO, $out, textual_type($self->head->mime_type) ? 1 : 0)
1922 0 15 unless my $fh = 'IO::File'->new(\$output, '>:')
1953 0 0 unless my $fh = 'IO::File'->new(\$output, '>:')