Branch Coverage

blib/lib/Mail/SpamAssassin/Message/Node.pm
Criterion Covered Total %
branch 97 200 48.5


line true false branch
49 40 0 if (eval { do { require Encode } })
52 0 40 if (eval { do { require Encode::Detect::Detector } })
110 0 231 unless defined $re and $re ne ''
112 0 231 unless defined $onlyleaves
115 0 231 if (defined $recursive and $recursive == 0)
126 245 17 if ($part->{'type'} =~ /$re/ and !$onlyleaves || $amialeaf)
130 18 0 if (not $amialeaf and !defined($depth) || $depth > 0)
131 0 18 if defined $depth
164 0 5494 unless defined $rawkey
173 800 4694 if (@_)
175 0 800 unless defined $raw_value
178 726 74 unless (exists $self->{'headers'}{$key})
194 4409 285 if (wantarray) { }
195 3612 797 unless exists $self->{'headers'}{$key}
199 251 34 unless exists $self->{'headers'}{$key}
229 475 0 if (wantarray) { }
230 353 122 unless exists $self->{'raw_headers'}{$key}
234 0 0 unless exists $self->{'raw_headers'}{$key}
280 0 0 if (ref $self->{'raw'} eq 'GLOB')
282 0 0 unless seek $fd, 0, 0
287 0 0 unless defined $nread
290 0 0 if $raw_str eq ''
309 132 96 unless (exists $self->{'decoded'})
312 0 132 unless exists $self->{'raw'}
317 4 128 if (ref $self->{'raw'} eq 'GLOB') { }
319 0 4 unless seek $fd, 0, 0
324 0 4 unless defined $nread
326 0 4 if $raw eq ''
335 6 126 if ($encoding eq 'quoted-printable') { }
5 121 elsif ($encoding eq 'base64') { }
345 0 5 if ($bytes) { }
353 1 4 if ($self->{'type'} =~ m[^(?:text|message)\b/]i)
359 19 102 if ($encoding) { }
369 224 4 if (not defined $bytes or $bytes)
370 224 0 if (not defined $bytes) { }
401 0 0 if ($check_char =~ /20 00/)
405 0 0 if ($check_char =~ /00 20/)
412 0 0 if $sum_h_e + $sum_l_e > ($sum_h_o + $sum_l_o) * 4
415 0 0 if ($sum_h_o + $sum_l_o) * 4 > $sum_h_e + $sum_l_e
417 0 0 if ($utf16le_clues > $utf16be_clues) { }
0 0 elsif ($utf16le_clues > $utf16be_clues) { }
436 0 105 if ($_[0] =~ /^(.{0,18}?<(?:body|head|html|img|pre|table|title)(?:\s.{0,18}?)?>)/is)
455 0 10 if utf8::is_utf8($_[0])
461 0 10 if (not defined $charset_declared or $charset_declared eq '')
468 0 10 if (not $cnt_8bits and $charset_declared =~ /^(?: (?:US-)?ASCII | ANSI[_ ]? X3\.4- (?:1986|1968) | ISO646-US )\z/six)
477 8 2 if (not $cnt_8bits and $charset_declared =~ /^(?: ISO[ -]?8859 (?: - \d{1,2} )? | Windows-\d{4} | UTF-?8 | (KOI8|EUC)-[A-Z]{1,2} | Big5 | GBK | GB[ -]?18030 (?:-20\d\d)? )\z/six)
490 0 2 if ($charset_declared =~ /^UTF-?8\z/i) { }
0 2 elsif ($charset_declared =~ /^UTF[ -]?16/i) { }
0 2 elsif ($cnt_8bits and eval { do { $rv = $enc_utf8->decode($_[0], 9); defined $rv } }) { }
0 2 elsif ($charset_declared =~ /^(?:US-)?ASCII\z/i) { }
492 0 0 if (eval { do { $rv = $enc_utf8->decode($_[0], 9); defined $rv } }) { }
494 0 0 unless $return_decoded
507 0 0 if (eval { do { $rv = $decoder->decode($_[0], 9); defined $rv } }) { }
509 0 0 unless $return_decoded
519 0 0 unless $return_decoded
545 0 2 if ($charset_declared =~ /^(?: ISO-?8859-1 | Windows-1252 | CP1252 )\z/xi) { }
549 0 2 if (not $decoder and $chset =~ /^GB[ -]?18030(?:-20\d\d)?\z/i)
551 0 0 if $decoder
555 0 2 if (not $decoder) { }
560 2 0 if (lc $chset eq lc $charset_declared) { }
561 2 0 defined $rv ? :
564 0 0 defined $rv ? :
577 0 2 if (not defined $rv || $cnt_8bits) { }
0 2 elsif (not defined $rv and $enc_w1252 and not $_[0] =~ tr/\000-\177\202\204\205\221-\227\231\240\251\255/\200\201\203\206-\220\230\232-\237\241-\250\252-\254\256-\377/c) { }
590 0 0 defined $rv ? :
598 2 0 if (defined $rv) { }
0 0 elsif (not $have_encode_detector) { }
605 0 0 if ($charset_detected and lc $charset_detected ne lc $charset_declared)
607 0 0 if (not $decoder and $charset_detected =~ /^GB[ -]?18030(?:-20\d\d)?\z/i)
609 0 0 if $decoder
612 0 0 if (not $decoder) { }
617 0 0 defined $rv ? :
624 0 2 unless (defined $rv)
627 0 0 defined $rv ? :
632 0 2 unless (defined $rv)
636 2 0 unless ($return_decoded)
657 113 16 unless (exists $self->{'rendered'})
662 0 113 unless $self->{'type'} =~ m[^text/(?:plain|html)$]i
669 7 106 if ($text ne '' and $self->{'type'} =~ m[^text/html$]i || $self->{'type'} =~ m[^text/plain$]i && _html_render(substr($text, 0, 23))) { }
677 0 7 if ($self->{'normalize'} and $enc_utf8) { }
6 1 elsif (not defined $self->{'charset'} or $self->{'charset'} =~ /^(?:US-ASCII|UTF-8)\z/i) { }
715 7 0 if $text_len
719 0 0 if ($self->{'normalize'} and $enc_utf8)
743 0 0 if not defined $type and defined $text
747 0 0 defined $text ? :
788 11 2 if (exists $self->{'body_parts'})
798 11 34 if (exists $part->{'body_parts'})
828 2 8 if ($cte eq 'B') { }
8 0 elsif ($cte eq 'Q') { }
852 50 750 unless defined $header_field_body and $header_field_body ne ''
858 297 453 if ($header_field_name =~ /^ (?: Received | (?:Resent-)? (?: Message-ID | Date ) | MIME-Version | References | In-Reply-To | List-.* ) \z /six) { }
916 0 4075 if ($raw) { }
917 0 0 if (@hdrs = $self->raw_header($hdr))
922 658 3417 if (@hdrs = $self->header($hdr))
927 3586 489 if (wantarray) { }
931 119 370 @hdrs ? :
976 0 332 if ($size > 65536)
985 0 26 if $self->{'truncated_header'}
987 0 10 if $include_mbox and exists $self->{'mbox_sep'}
989 16 10 wantarray ? :