Branch Coverage

blib/lib/MIME/EncWords.pm
Criterion Covered Total %
branch 168 238 70.5


line true false branch
167 42 48 if &is_utf8($str)
174 0 0 if ($cset eq 'UTF-16' or $cset eq 'UTF-16BE') { }
0 0 elsif ($cset eq 'UTF-16LE') { }
0 0 elsif ($cset eq 'UTF-32' or $cset eq 'UTF-32BE') { }
0 0 elsif ($cset eq 'UTF-32LE') { }
195 0 57 unless (length($str) % 4 == 0 and $str =~ m[^[A-Za-z0-9+/]+={0,2}$])
208 0 49 if ($str =~ /=(?![0-9a-fA-F][0-9a-fA-F])/)
231 27 462 $& eq ' ' ? :
342 39 0 $1 ? :
353 72 193 if pos $encstr >= length $encstr
357 106 87 if ($encstr =~ /\G # from where we left off.. =\?([^?]*) # "=?" + charset + \?([bq]) # "?" + encoding + \?([^?]+) # "?" + data maybe with spcs + \?= # "?=" ([\r\n\t ]*) /gix)
368 4 102 if ($charset =~ s/^([^\*]*)\*(.*)/$1/) { }
375 49 57 if ($encoding eq 'q') { }
380 0 106 unless (defined $dec)
388 24 82 if (scalar @tokens and lc($charset || '') eq lc($tokens[-1][1] || '') and &resolve_alias($charset) and !($tokens[-1][2] || $language) || lc $tokens[-1][2] eq lc $language) { }
4 78 elsif ($language) { }
78 0 elsif ($charset) { }
409 6 81 if ($encstr =~ /\G=\?/gx)
418 81 0 if ($encstr =~ /\G # from where we left off... (.*? # shortest possible string, \n*) # followed by 0 or more NLs, (?=(\Z|=\?)) # terminated by "=?" or EOS /gsx)
423 0 81 unless length $1
433 0 72 if $spc
436 72 0 if ($Params{'Detect7bit'} ne 'NO')
439 87 82 unless ($$t[0] =~ /$UNSAFE/ or $$t[1])
441 0 87 if ($charset and $charset ne &MIME::Charset::default())
448 24 48 if (wantarray) { }
470 0 111 unless &MIME::Charset::USE_ENCODE
471 45 66 unless $cset->as_string
472 0 66 unless $cset->decoder or $cset->as_string eq '_UNICODE_'
477 0 66 if ($charset->as_string and $charset->as_string eq $cset->as_string)
484 0 66 if (&is_utf8($s) or $s =~ /$WIDECHAR/) { }
37 29 elsif ($charset->output_charset eq '_UNICODE_') { }
18 11 elsif ($charset->decoder) { }
485 0 0 if ($charset->output_charset ne '_UNICODE_')
489 18 19 if (not $charset->decoder) { }
490 0 18 if ($s =~ /$UNSAFE/)
497 0 0 if ($@)
542 144 0 if (ref $charset) { }
543 0 144 if (&is_utf8($word) or $word =~ /$WIDECHAR/)
551 71 73 if ($encoding eq 'Q') { }
0 73 elsif ($encoding eq 'S') { }
555 0 0 if (length $B < length $Q) { }
567 0 144 if ($language) { }
719 0 90 unless $Params{'Encoding'} =~ /^[ABQS]$/
723 90 0 if ($Params{'Folding'} =~ /^([\r\n]*)([\t ]?)$/) { }
736 5 85 $Params{'Field'} ? :
740 0 90 if (not $Params{'Minimal'}) { }
90 0 elsif (not $Params{'Minimal'} =~ /^(NO|DISPNAME)$/) { }
746 0 90 $maxrestlen <= 1 ? :
749 0 90 if $Params{'Minimal'} eq 'DISPNAME'
752 66 24 unless (ref $words eq 'ARRAY')
754 24 42 if ($charsetobj->as_string =~ /$ASCIIINCOMPAT/)
761 1 0 $1 ? :
764 66 0 if ($Params{'Minimal'} =~ /YES|DISPNAME/) { }
767 0 640 unless scalar @words or length $w
768 287 353 if ($w =~ /[\t ]/)
775 6 347 if ($charsetobj->as_string =~ /$ASCIITRANS/)
777 0 6 if (&is_utf8($w) or $w =~ /$WIDECHAR/) { }
786 287 66 if (scalar @words) { }
787 61 226 if ($w =~ /$NONPRINT|$UNSAFEASCII/ or $u ne $w xor $unsafe_last) { }
789 40 21 if ($unsafe_last) { }
806 0 66 if ($spc)
807 0 0 if (scalar @words) { }
823 0 211 unless length $s
828 66 145 if ($csetobj->as_string and $csetobj->as_string =~ /$ASCIIINCOMPAT/)
837 45 166 unless ($obj->as_string)
838 6 39 if ($Params{'Encoding'} ne 'A' or $Params{'Detect7bit'} eq 'NO' or $s =~ /$UNSAFE/)
849 56 54 if defined $enc and $Params{'Encoding'} eq 'S' || $Params{'Encoding'} eq 'A' && $obj->header_encoding eq 'S'
855 4 207 if ($cset eq 'US-ASCII' and not $enc and $s =~ /$UNSAFEASCII/) { }
863 2 2 $Params{'Encoding'} eq 'A' ? :
878 121 90 if (scalar @triplets)
880 26 95 if ($csetobj->decoder and ($lastcsetobj->as_string || '') eq $csetobj->as_string and ($lastenc || '') eq ($enc || '')) { }
7 88 elsif (not $lastenc and $enc and not $last =~ /[\r\n\t ]$/) { }
16 73 elsif ($lastenc and not $enc and not $s =~ /^[\r\n\t ]/) { }
886 7 0 if ($last =~ /^(.*)([\r\n\t ])([$PRINTABLE]+)$/s) { }
0 0 elsif ($lastcsetobj->as_string eq 'US-ASCII') { }
896 16 0 if ($s =~ /^([$PRINTABLE]+)([\r\n\t ])(.*)$/s) { }
0 0 elsif ($csetobj->as_string eq 'US-ASCII') { }
909 99 86 if $$_[1]
910 42 48 if (scalar @s_enc)
912 49 35 if $$_[1]
913 49 35 if $$_[1]
915 7 35 if ($Params{'Encoding'} eq 'A' and $b and not $q) { }
0 35 elsif ($Params{'Encoding'} eq 'A' and not $b and $q) { }
927 21 14 if ($total + 8 < $q * 6) { }
934 42 42 if $$_[1] and $$_[1] eq 'S'
940 0 0 unless length $triplets[0][0]
946 0 90 if ($Params{'MaxLineLen'} < 0) { }
957 99 86 if ($lastenc) { }
962 78 107 if scalar @s > 1
964 4 181 if $restlen <= 1
973 0 279 unless length $str
976 135 144 if (not $encoding) { }
982 143 136 scalar @lines && $lines[-1] =~ /[\r\n\t ]$/ || $s =~ /^[\r\n\t ]/ ? :
984 90 189 if (not scalar @lines) { }
0 189 elsif ($Params{'MaxLineLen'} < 0) { }
91 98 elsif (length $lines[-1] . $spc . $s <= $restlen) { }
991 4 94 if ($lines[-1] =~ s/([\r\n\t ]+)$//)
1016 0 185 if (not $charset->as_string or $charset->as_string eq '8BIT')
1020 86 99 if (not $encoding and $charset->as_string eq 'US-ASCII')
1023 0 99 if (not $charset->decoder and 'Encode')
1029 98 46 if ($charset->encoded_header_len($str, $encoding) <= $restlen)
1034 46 0 if (not &is_utf8($ustr) || $ustr =~ /$WIDECHAR/ and 'Encode')
1040 4 42 if ($first and not $str and $maxrestlen < $charset->encoded_header_len($first, $encoding))
1067 0 990 unless scalar @splitwords or defined $word
1068 467 523 if ($word =~ /[\t ]/)
1075 64 459 unless $elen
1076 373 86 if (scalar @splitwords) { }
1079 324 49 if ($elen <= $restlen) { }
1092 30 56 if ($spc)
1093 30 0 if (scalar @splitwords) { }
1115 0 50 unless length $ustr
1126 129 110 if ($elen <= $restlen) { }
1147 50 0 unless $@
1150 0 0 unless ($shorter < $max)
1155 46 4 if (length $fenc) { }
1178 338 948 if (lc $i eq lc $k)
1184 0 338 unless $supported
1188 670 284 unless defined $GotParams{$i}
1192 0 162 if (not $GotParams{$i} or uc $GotParams{$i} eq 'NO') { }