Branch Coverage

lib/Mail/Make/Entity.pm
Criterion Covered Total %
branch 129 260 49.6


line true false branch
54 0 218 unless $self->SUPER::init(@_)
63 1 42 unless ($self->_is_a($part, "Mail::Make::Entity"))
77 0 36 unless open my $fh, ">:raw", \$out
79 0 36 unless $self->print($fh)
91 0 1 unless open my $fh, ">:raw", \$out
93 0 1 unless $self->print($fh)
103 84 5 if (@_)
106 84 0 if (defined $body)
108 0 84 unless ($self->_is_a($body, "Mail::Make::Body"))
124 0 0 unless (defined $self->{'body'})
130 0 0 if (CORE::length $enc and not $self->{'is_encoded'})
132 0 0 unless $self->encode_body
159 0 110 ref $class ? :
160 0 110 unless $self
169 54 56 defined $opts->{'encoding'} ? :
172 21 89 defined $opts->{'disposition'} ? :
180 0 110 exists $opts->{'top'} ? :
182 3 107 if (not defined $path || defined $data and exists $opts->{'attach'} and defined $opts->{'attach'} and !ref($opts->{'attach'}) || $self->_can_overload($opts->{'attach'}, '""') and index("$opts->{'attach'}", "\n") == -1) { }
8 99 elsif (not $has_type and defined $path and CORE::length $path) { }
190 2 1 if ($f->exists)
194 2 0 unless ($has_type)
197 2 0 if $candidate
206 8 0 if $candidate
217 54 56 if (defined $charset) { }
219 54 0 if (not $is_multipart) { }
221 0 54 unless $ct_obj->param("charset", $charset)
233 9 47 if ($type =~ m[^text/]i and not $is_multipart)
235 0 9 unless $ct_obj->param("charset", "utf-8")
241 16 84 if (not defined $filename and defined $path and CORE::length $path)
246 0 110 if defined $filename and not CORE::length $filename
253 26 84 if (defined $filename and not $is_multipart)
255 0 26 unless $ct_obj->param("name", $filename)
260 24 86 if ($is_multipart)
262 1 23 if (defined $boundary)
264 0 1 if (not CORE::length $boundary) { }
1 0 elsif ($boundary =~ m[[^0-9a-zA-Z'()+_,\-./:=? ]]) { }
277 0 23 unless $ct_obj->param("boundary", $boundary)
282 54 55 if (defined $encoding)
284 1 53 if ($is_multipart) { }
0 53 elsif ($is_message) { }
0 53 elsif ($encoding eq 'suggest') { }
305 0 52 if ($cte_obj->is_binary and $type =~ m[^text/]i)
313 0 107 ref $class ? :
314 0 107 unless $entity
320 85 22 unless ($is_multipart)
322 26 59 if (defined $path and CORE::length $path) { }
58 1 elsif (defined $data) { }
341 31 52 unless ($is_multipart or defined $encoding)
352 83 0 if (not $is_multipart and defined $encoding and CORE::length $encoding)
358 26 57 if (not $is_multipart and defined $disposition || defined $filename)
361 5 0 defined $filename ? :
364 25 0 if (defined $filename)
366 0 25 unless $cd_obj->filename($filename)
373 7 97 if (defined $cid and CORE::length $cid)
376 7 0 unless $cid =~ /\A<[^>]+>\z/
381 0 104 if (defined $description and CORE::length $description)
394 138 206 if (@_)
400 0 206 unless (defined $self->{'effective_type'})
403 0 0 $self->{'headers'} ? :
417 1 50 if $self->{'is_encoded'}
419 0 50 unless CORE::length $enc
421 0 50 unless (defined $body)
427 0 50 if ($enc ne "base64" and $enc ne "quoted-printable")
440 12 38 if ($body->is_on_file) { }
444 12 0 if ($enc eq 'base64') { }
447 0 12 unless $encoder->encode($from_fh, $tmp)
453 0 0 unless $encoder->encode($from_fh, $tmp)
462 0 38 if ($enc eq 'base64') { }
465 0 0 unless $encoder->encode($from_fh, \$out)
471 0 38 unless $encoder->encode($from_fh, \$out)
487 0 0 if (@_)
490 0 0 ref $val eq 'ARRAY' ? :
500 108 282 if (@_)
503 0 108 unless ($self->_is_a($h, "Mail::Make::Headers"))
510 0 282 unless (defined $self->{'headers'})
522 0 0 if (@_)
524 0 0 shift @_ ? :
536 17 55 $type =~ m[^multipart/]i ? :
544 0 0 $self->textual_type($self->effective_type) ? :
571 0 0 if ($self->is_multipart) { }
0 0 elsif (@{$self->{'_parts'};}) { }
574 0 0 unless (defined $boundary and CORE::length $boundary)
580 0 0 if (@{$self->{'preamble'};})
589 0 0 unless defined $part_len
598 0 0 if (@{$self->{'epilogue'};})
609 0 0 if $need_sep++
611 0 0 unless defined $part_len
619 0 0 unless (defined $self->{'body'})
623 0 0 unless $self->encode_body
625 0 0 unless defined $body_len
651 0 11 if (@_)
653 0 0 ref $_[0] eq 'ARRAY' ? :
656 0 0 unless ($self->_is_a($part, "Mail::Make::Entity"))
664 0 11 wantarray ? :
671 0 0 if (@_)
674 0 0 ref $val eq 'ARRAY' ? :
687 0 64 unless ($self->_is_glob($fh))
692 0 64 unless print $fh $self->headers->as_string
695 0 64 unless print $fh $Mail::Make::Entity::CRLF
698 0 64 unless $self->print_body($fh)
709 0 64 unless ($self->_is_glob($fh))
713 13 51 if ($self->is_multipart) { }
0 51 elsif (@{$self->{'_parts'};}) { }
716 0 13 unless (defined $boundary and CORE::length $boundary)
722 0 13 if (@{$self->{'preamble'};})
728 0 27 unless print $fh "--$boundary$Mail::Make::Entity::CRLF"
730 0 27 unless $part->print($fh)
732 0 27 unless print $fh $Mail::Make::Entity::CRLF
735 0 13 unless print $fh "--$boundary--$Mail::Make::Entity::CRLF"
738 0 13 if (@{$self->{'epilogue'};})
749 0 0 if $need_sep++
750 0 0 unless $part->print($fh)
756 0 51 unless (defined $self->{'body'})
760 0 51 unless $self->encode_body
763 0 51 unless print $fh $$in_ref
795 0 31 if $type =~ m[^multipart/]
796 0 31 if $type =~ m[^message/]
797 8 23 if $type =~ m[^text/]
806 0 0 unless defined $type and CORE::length $type
807 0 0 $type =~ m[^(text|message)(/|\z)]i ? :
818 1 1 if $self->is_multipart
822 1 0 if ($h)
826 0 1 unless $ct_obj->boundary($boundary)
827 0 1 unless $h->set("Content-Type", "$ct_obj")
830 1 0 if ($self->body)
837 1 0 $h ? :
838 1 0 if defined $orig_ct
854 1 0 if (my $body = $self->body)
873 0 13 unless CORE::length $ct
875 13 0 if ($ct =~ /;\s*boundary=(?:"([^"]+)"|([^;\s]+))/i)