Branch Coverage

blib/lib/MIME/Entity.pm
Criterion Covered Total %
branch 155 234 66.2


line true false branch
294 82 18 unless $KnownField{$field}
377 131 0 unless defined $index
380 131 0 if $index < 0
562 38 0 unless ref $self
573 10 28 exists $params{'Top'} ? :
579 6 32 exists $params{'Filename'} ? :
580 0 38 if defined $filename and $filename eq ''
583 7 31 if ($type =~ m[^(multipart/|message/(rfc822|partial|external-body|delivery-status|disposition-notification|feedback-report)$)]i)
584 2 5 unless $encoding =~ /^(|7bit|8bit|binary|-suggest)$/i
589 5 31 if ($is_multipart) { }
592 2 3 if (defined($boundary = $params{'Boundary'}))
593 0 2 if ($boundary eq '') { }
0 2 elsif ($boundary =~ m[[^0-9a-zA-Z_\'\(\)\+\,\.\/\:\=\?\- ]]) { }
604 3 2 unless defined $boundary
608 14 17 if ($params{'Path'}) { }
17 0 elsif (defined $params{'Data'}) { }
619 6 25 unless textual_type($type)
633 1 35 if $charset
634 17 19 if defined $filename
635 5 31 if defined $boundary
640 29 7 if (not $encoding) { }
3 4 elsif (lc $encoding eq '-suggest') { }
648 31 5 unless ($is_multipart)
651 17 14 if defined $filename
656 36 0 if $encoding
657 0 36 if $desc
662 2 34 if (defined $id)
663 1 1 unless ($id =~ /^<.*>$/)
668 26 10 if $top
671 26 10 if $top
680 2 100 if ($tag =~ /^-(.*)/s) { }
0 100 elsif ($tag =~ /(.*):$/s) { }
18 82 elsif (known_field(lc $tag)) { }
687 0 20 ref $value ? :
688 0 20 unless defined $value and $value ne ''
718 0 20 unless ref $self->{$_}
721 4 3 $self->bodyhandle ? :
725 2 12 if $self->{$_}
781 0 3 if (@_ > 1) { }
785 0 3 unless my $fh = 'IO::File'->new(\$output, '>:')
832 174 464 if @_ > 1
869 0 300 if @_
870 0 300 $self->{'ME_EffType'} ? :
890 39 15 if @_ > 1
911 212 1666 if @_ > 1
934 0 33 unless $self->head
936 18 15 $type eq 'multipart' ? :
956 0 0 wantarray ? :
0 387 unless $self->head
975 74 0 if $self->bodyhandle
1022 5 216 if ref $_[0]
1023 107 109 @_ ? :
1061 43 18 if @_ > 1
1137 9 3 if $self->is_multipart and not $force
1182 0 1 unless $self->is_multipart
1183 0 1 if $self->parts > 1
1191 0 1 if ($self->parts == 1) { }
1205 0 0 if $self->is_multipart
1244 3 1 if $self->bodyhandle
1263 2 23 if ($body->[$line] =~ /\A--[ \040][\r\n]+\Z/)
1304 2 1 if ($self->is_multipart)
1306 1 1 if ($first_part)
1313 0 1 unless textual_type($self->head->mime_type)
1317 0 1 unless $self->bodyhandle
1399 3 3 if ($self->is_multipart and not $params{'Attach'})
1405 0 3 if (defined($sig = $params{'Signature'})) { }
3 0 elsif ($params{'File'}) { }
1406 0 0 ref $sig ? :
1409 0 3 unless my $fh = 'IO::File'->new($params{'File'})
1411 0 3 unless $fh->close
1418 0 3 if ($params{'Attach'}) { }
1428 0 0 unless $self->head->mime_type =~ m[text/]i or $params{'Force'}
1432 0 3 unless $self->bodyhandle
1436 3 0 if (not defined $params{'Remove'} or $params{'Remove'} > 0)
1442 0 3 unless $io = $self->open('w')
1444 0 3 unless ($body[-1] || '') =~ /\n\Z/
1446 0 3 unless $io->close
1479 2 1 if ($type eq 'text' or $type eq 'message') { }
1480 0 0 $self->parts ? :
0 2 unless $self->bodyhandle
1482 2 0 if ($IO = $self->bodyhandle->open('r'))
1486 1 5 if $unclean = length $_ > 999 || /[\200-\377]/
1491 0 1 $type eq 'message' ? :
1 1 $unclean ? :
1497 0 1 $type eq 'multipart' ? :
1504 25 4 $type =~ /^(text|message|multipart)$/ ? :
1561 1 4 int(@_) % 2 == 0 ? :
1572 5 0 if ($o_nonstandard eq 'ERASE')
1575 0 19 if ($tag =~ /\AContent-/i and not $tag =~ /\AContent-$StandardFields\Z/io)
1583 5 0 if ($o_length eq 'COMPUTE') { }
0 0 elsif ($o_length eq 'ERASE') { }
1587 1 4 if ($self->is_multipart) { }
1593 4 0 unless ($ENCBODY)
1616 0 4 unless $part->sync_headers($opts)
1674 0 0 unless $fh
1675 0 0 unless defined $indent
1686 0 0 $self->bodyhandle ? :
1691 0 0 if $filename
1695 0 0 unless defined $subj
1697 0 0 if $subj
1701 0 0 if @parts
1780 1 66 if @_ < 2
1781 8 59 unless ref $out
1828 12 71 if ($type eq 'multipart') { }
0 71 elsif ($self->parts) { }
1833 9 3 if (defined $plines) { }
1836 2 7 if @$plines > 0
1852 3 9 unless $self->epilogue
1853 1 11 if ($epilogue ne '')
1855 0 1 unless $epilogue =~ /\n\Z/
1866 0 0 if $need_sep++
1873 71 0 $self->bodyhandle ? :
1893 7 64 if ($self->bodyhandle->is_encoded) { }
1903 58 6 textual_type($self->head->mime_type) ? :
0 64 unless $decoder->encode($IO, $out, textual_type($self->head->mime_type) ? 1 : 0)
1936 0 19 unless my $fh = 'IO::File'->new(\$output, '>:')
1967 0 0 unless my $fh = 'IO::File'->new(\$output, '>:')