Branch Coverage

lib/MIME/Lite.pm
Criterion Covered Total %
branch 136 368 36.9


line true false branch
483 5 1 $MIME::Lite::VANILLA ? :
516 0 0 unless $str
523 0 0 if ($str =~ /\G$SEP($PHRASE)\s*<\s*($ADDR)\s*>/cog) { }
0 0 elsif ($str =~ /\G$SEP($ADDR)/cog or $str =~ /\G$SEP($ATOM)/cog) { }
532 0 0 wantarray ? :
536 0 0 /<([^>]+)>/ ? :
537 0 0 wantarray ? :
545 0 0 wantarray ? :
10 0 wantarray ? :
698 15 10 @_ ? :
755 0 10 @_ == 1 ? :
758 5 5 unless ($attrs->{'content-type'} =~ m[^(multipart|message)/]i)
993 0 20 unless defined($params{'Data'}) + defined($params{'Path'}) + defined($params{'FH'}) <= 1
997 5 15 unless ref $self
1007 13 7 if ($type eq 'TEXT') { }
0 7 elsif ($type eq 'HTML') { }
0 7 elsif ($type eq 'BINARY') { }
1 6 elsif ($type eq 'AUTO') { }
1022 1 19 if ($is_multipart)
1030 0 20 if (defined $params{'Id'})
1032 0 0 unless $id =~ /\A\s*<.*>\s*\z/
1043 13 7 if (defined $params{'Data'}) { }
4 3 elsif (defined $params{'Path'}) { }
0 3 elsif (defined $params{'FH'}) { }
1049 1 3 if $params{'ReadNow'}
1055 0 0 if $params{'ReadNow'}
1062 1 19 if (defined $params{'Filename'})
1076 1 19 if ($type =~ m[^(multipart|message)/])
1077 0 1 unless $enc =~ /^(7bit|8bit|binary)\Z/
1090 0 20 if (exists $params{'Length'}) { }
1097 10 10 defined $params{'Top'} ? :
1103 10 10 if ($ds_wanted || $ds_defaulted and not exists $params{'Date'})
1116 0 49 if ($lc_tag =~ /^-(.*)/) { }
0 49 elsif ($lc_tag =~ /^(.*):$/) { }
13 36 elsif ($KnownField{$lc_tag} or $lc_tag =~ /^(content|resent|x)-./) { }
1160 15 15 if ($onoff) { }
1162 15 0 @Uses ? :
1163 1 14 unless $MIME::Lite::VANILLA
1213 0 27 if is_mime_field($tag) and not $MIME::Lite::QUIET
1219 1 26 ref $value && ref $value eq 'ARRAY' ? :
1269 2 1 if (defined $subtag)
1275 2 1 if (@_ > 2)
1276 2 0 if (defined $value) { }
1289 0 0 defined $self->{'Attrs'}{$attr} ? :
1315 7 4 if $field->[0] ne $tag
1344 1 0 if (ref $self) { }
1392 0 71 if $explicit{$tag}
1396 15 56 unless defined $value
1399 9 47 if (my $subs = $sub_attrs->{$tag})
1421 16 1 unless $self->{'FieldOrder'}
1422 16 1 unless @order
1423 1 16 if (@order)
1468 5 0 if (@_ > 1)
1499 0 12 if is_mime_field($tag)
1501 23 43 $_->[0] eq $tag ? :
1502 2 3 wantarray ? :
7 5 defined $index ? :
1550 17 20 if (not $is_multipart and $enc eq 'binary')
1551 13 4 if (defined $self->{'Data'}) { }
0 4 elsif (defined $self->{'FH'}) { }
4 0 elsif (defined $self->{'Path'}) { }
1556 2 2 if -e $self->{'Path'}
1579 0 9 unless $self->{'Parts'}
1612 0 0 if @_
1649 2 0 if defined $value
1679 0 0 if (not @a) { }
0 0 elsif ($expl and ref $expl eq 'ARRAY') { }
1685 0 0 if (not $self->_safe_attr('content-disposition.filename') or $self->_safe_attr('content-type.name'))
1692 0 0 if ($self->_safe_attr('content-transfer-encoding') =~ /^(7bit|8bit|binary)$/i)
1697 0 0 if ($self->_safe_attr('content-type.charset') =~ /^(us-ascii)/i)
1702 0 0 if (keys %{$$self{'Attrs'}{'content-type'};} == 1 and $self->_safe_attr('content-type') eq 'text/plain')
1751 0 2 if @_
1754 0 2 defined $self->{'Binmode'} ? :
1775 13 0 if (@_)
1776 2 11 ref $_[0] eq 'ARRAY' ? :
1798 0 0 if @_
1818 4 0 if (@_)
1825 3 1 if ($self->{'Path'} and not $self->{'Path'} =~ /\|$/)
1829 3 0 if ($HaveFileBasename) { }
1892 0 1 if ($self->{'FH'}) { }
1 0 elsif ($self->{'Path'}) { }
1895 0 0 if $self->binmode
1901 0 1 unless open SLURP, $self->{'Path'}
1902 0 1 if $self->binmode
1943 0 0 unless @_
1946 0 0 unless defined $self->{'Data'}
1950 0 0 unless (defined($sig = $params{'Data'}))
1952 0 0 unless open SIG, $params{'Path'}
1956 0 0 if ref $sig and ref $sig eq 'ARRAY'
1997 20 0 if ($HaveMimeTypes)
2001 19 1 if (scalar @mappings)
2004 19 0 if ($encoding and $encoding =~ /^(base64|binary|[78]bit|quoted-printable)$/i)
2015 0 1 if ($type eq 'text' or $type eq 'message') { }
2018 1 0 $type eq 'multipart' ? :
2035 0 1 unless $path
2038 1 0 if ($HaveMimeTypes)
2042 1 0 if $mimetype and $mimetype =~ m[^\S+/\S+$]
2067 4 32 if ($path and not $path =~ /\|$/)
2069 1 3 unless -r $path
2113 16 0 if $MIME::Lite::AUTO_VERIFY
2177 4 12 if ($type =~ m[^multipart/]i) { }
0 12 elsif ($type =~ m[^message/]) { }
2183 0 4 defined $self->{'Preamble'} ? :
2199 0 0 if (@parts == 0) { }
0 0 elsif (@parts == 1) { }
2237 0 12 if $MIME::Lite::DEBUG
2245 11 1 if (defined $self->{'Data'}) { }
1 0 elsif (defined $self->{'Path'} or defined $self->{'FH'}) { }
2250 0 11 if (/^BINARY$/)
2251 0 0 if $is_smtp
2255 11 0 if (/^8BIT$/)
2259 0 0 if (/^7BIT$/)
2263 0 0 if (/^QUOTED-PRINTABLE$/)
2275 0 0 if (/^BASE64/)
2292 1 0 if (defined $self->{'Path'}) { }
2294 0 1 unless $DATA->open("$self->{'Path'}")
2299 0 1 if $self->binmode
2306 0 1 if (/^BINARY$/)
2309 0 0 if length $last
2312 0 0 if (length $last)
2313 0 0 if $is_smtp
2318 1 0 if (/^8BIT$/)
2322 0 0 if (/^7BIT$/)
2326 0 0 if (/^QUOTED-PRINTABLE$/)
2330 0 0 if (/^BASE64$/)
2338 1 0 if defined $self->{'Path'}
2429 0 66 if $value eq ''
2575 0 2 if (ref $self) { }
2577 0 0 if (@_) { }
2582 0 0 unless $SenderArgs{$Sender}
2584 0 0 if $MIME::Lite::AUTO_VERIFY
2585 0 0 unless $self->can($method)
2588 2 0 if (@_) { }
2677 0 0 if (not ref $item) { }
0 0 elsif (UNIVERSAL::isa($item, 'HASH')) { }
0 0 elsif (UNIVERSAL::isa($item, 'ARRAY')) { }
2694 0 0 if (@_ == 1 and not ref $_[0]) { }
2697 0 0 unless $sendmailcmd
2701 0 0 unless open SENDMAIL, "|$sendmailcmd"
2704 0 0 $? >> 8 ? :
2708 0 0 unless defined $p{'Sendmail'}
2711 0 0 unless $p{'BaseArgs'}
2714 0 0 unless defined $p{'SetSender'}
2720 0 0 if ($p{'SetSender'})
2722 0 0 if ($from)
2724 0 0 if $from_addr
2730 0 0 unless defined $pid
2731 0 0 if (not $pid) { }
2732 0 0 unless exec @cmd
2736 0 0 unless close SENDMAIL
2854 0 0 exists $args->{$_} ? :
2865 0 0 if ($MIME::Lite::AUTO_CC)
2870 0 0 unless @hdr_to
2882 0 0 unless my $smtp = 'MIME::Lite::SMTP'->new($hostname, %opts)
2886 0 0 if (defined $args{'AuthUser'} and defined $args{'AuthPass'} and not $args{'NoAuth'})
2889 0 0 if ($smtp->supports('AUTH', 500, [q[Command unknown: 'AUTH']])) { }
2891 0 0 unless $smtp->auth($args{'AuthUser'}, $args{'AuthPass'})
2900 0 0 %opts ? :
0 0 unless $smtp->mail($args{'From'}, %opts ? \%opts : ())
2906 0 0 %opts ? :
0 0 unless $smtp->recipient(@{$args{'To'};}, %opts ? \%opts : ())
2911 0 0 unless $smtp->data
2917 0 0 unless $smtp->dataend
2944 0 0 if (@_ == 1 and not ref $_[0])
2947 0 0 unless $filename
2952 0 0 unless open FILE, ">> $filename"
2955 0 0 $? >> 8 ? :
2989 0 0 if $MIME::Lite::DEBUG
2995 0 0 unless defined $to
3000 0 0 if ($MIME::Lite::AUTO_CC)
3003 0 0 if defined $value
3010 0 0 unless my $smtp = 'MIME::Lite::SMTP'->new(@args)
3012 0 0 unless $smtp->mail($from)
3014 0 0 unless $smtp->to(@to_all)
3016 0 0 unless $smtp->data
3022 0 0 unless $smtp->dataend
3094 0 0 if @_
3137 0 0 if $MIME::Lite::DEBUG
3138 0 0 unless $smtp->datasend(@_)
3159 0 44 unless $fh
3160 0 44 unless ref $fh
3163 44 0 if ref $fh and ref $fh ne 'GLOB'
3185 0 7 unless defined $scalarref
3205 0 0 unless defined $arrayref