Branch Coverage

blib/lib/XML/TreePP.pm
Criterion Covered Total %
branch 259 406 63.7


line true false branch
465 4 13 if $$self{'ignore_error'}
472 0 2 if $$self{'ignore_error'}
480 31 3 if (defined $val) { }
491 0 0 if exists $$self{$key}
497 0 3 unless my $tree = shift()
499 0 3 unless defined $file
501 1 2 if ($ALLOW_UTF8_FLAG and utf8::is_utf8($text))
509 3 165 unless my $tree = shift()
513 163 2 unless defined $decl
516 6 159 if (exists $$self{'first_out'})
518 0 6 unless ref $keys
523 2 163 if (exists $$self{'last_out'})
525 0 2 unless ref $keys
529 3 162 if exists $$self{'text_node_key'}
530 29 136 unless defined $tnk
533 8 157 if exists $$self{'attr_prefix'}
534 28 137 unless defined $apre
539 2 163 if (exists $$self{'indent'} and $$self{'indent'})
543 3 162 unless (UNIVERSAL::isa($tree, 'HASH'))
548 162 0 if ($from and $to)
550 0 160 unless $stat
553 1 159 if $decl eq ''
561 0 0 if (exists $$self{'user_agent'}) { }
563 0 0 if $agent =~ /\s$/s
564 0 0 if $agent ne ''
570 0 0 unless ($http)
574 0 0 if ($http eq 'LWP::UserAgent') { }
0 0 elsif ($http eq 'HTTP::Lite') { }
588 0 0 if (exists $$self{'lwp_useragent'} and ref $$self{'lwp_useragent'})
589 0 0 if defined $LWP::UserAgent::VERSION
590 0 0 if &load_lwp_useragent()
594 0 0 if (exists $$self{'http_lite'} and ref $$self{'http_lite'})
595 0 0 if defined $HTTP::Lite::VERSION
596 0 0 if &load_http_lite()
600 0 0 if defined $LWP::UserAgent::VERSION
601 0 0 if defined $HTTP::Lite::VERSION
602 0 0 if &load_lwp_useragent()
603 0 0 if &load_http_lite()
608 0 0 if defined $LWP::UserAgent::VERSION
615 0 0 if defined $HTTP::Lite::VERSION
622 0 0 if defined $Tie::IxHash::VERSION
630 0 0 unless my $method = shift()
631 0 0 unless my $url = shift()
635 0 0 if exists $$self{'lwp_useragent'}
636 0 0 if (not ref $ua) { }
640 0 0 if defined $$self{'__user_agent'}
642 0 0 if exists $$self{'user_agent'}
647 0 0 if (ref $header)
651 0 0 if $field =~ /^Content-Type$/i
654 0 0 if (defined $body and not $ct)
657 0 0 if defined $body
661 0 0 if ($res->can('decoded_content')) { }
666 0 0 if $res->is_success
667 0 0 wantarray ? :
672 0 0 unless my $method = shift()
673 0 0 unless my $url = shift()
680 0 0 if (ref $header)
684 0 0 if $field =~ /^User-Agent$/i
687 0 0 if (defined $$self{'__user_agent'} and not $ua)
690 0 0 if defined $body
691 0 0 unless my $code = $http->request($url)
694 0 0 wantarray ? :
700 0 33 unless defined $file
707 32 242 ref $_[0] ? :
708 1 273 unless defined $text
712 273 0 if ($from and $to)
714 0 271 unless $stat
719 7 264 if (exists $$self{'force_array'})
721 1 6 unless ref $force
728 2 269 if (exists $$self{'force_hash'})
730 1 1 unless ref $force
735 3 268 if exists $$self{'text_node_key'}
736 34 237 unless defined $tnk
739 8 263 if exists $$self{'attr_prefix'}
740 35 236 unless defined $apre
743 0 271 if (exists $$self{'use_ixhash'} and $$self{'use_ixhash'})
744 0 0 unless &load_tie_ixhash()
748 3 268 if (exists $$self{'require_xml_decl'} and $$self{'require_xml_decl'})
749 2 1 unless looks_like_xml(\$text)
753 1 268 if exists $$self{'base_class'}
755 268 0 if (ref $tree)
756 1 267 if (defined $class) { }
1 532 elsif (exists $$self{'elem_class'} and $$self{'elem_class'}) { }
763 0 268 wantarray ? :
775 13 256 if ($xml_deref)
776 7 6 if (exists $$self{'utf8_flag'} and $$self{'utf8_flag'} or $ALLOW_UTF8_FLAG and utf8::is_utf8($$textref)) { }
805 0 2358 if (defined $ahead and $ahead =~ /\S/)
810 2043 315 if ($typeElem) { }
177 138 elsif ($typeCDATA) { }
28 110 elsif ($typeCmnt) { }
0 110 elsif ($typeDocT) { }
110 0 elsif ($typePI) { }
812 960 1083 if ($contElem =~ s[^/][]) { }
123 960 elsif ($contElem =~ s[/$][]) { }
821 2043 0 if $contElem =~ s/^(\S+)\s*//
822 1083 960 unless ($$node{'endTag'})
828 329 24 $2 ? :
829 235 118 unless (ref $attr)
831 0 235 if $ixhash
835 235 848 if ref $attr
840 114 63 if (exists $$self{'cdata_scalar_ref'} and $$self{'cdata_scalar_ref'}) { }
856 698 1660 if ($follow =~ /\S/)
872 0 1229 if (exists $$self{'use_ixhash'} and $$self{'use_ixhash'})
878 875 2042 if (not ref $node or UNIVERSAL::isa($node, 'SCALAR'))
883 959 1083 if ($$node{'endTag'})
884 957 2 if $parent eq $name
890 15 1068 if (defined $class)
895 960 123 if ($$node{'startTag'}) { }
2 242 elsif ($forcehash and not ref $elem) { }
897 1 957 unless defined $child
898 123 834 if ref $elem
899 189 768 if (UNIVERSAL::isa($child, 'HASH')) { }
900 92 97 if ($hasattr) { }
910 31 737 if ($hasattr) { }
7 730 elsif ($forcehash) { }
928 341 739 if (ref $elem and UNIVERSAL::isa($elem, 'HASH'))
929 10 331 if (defined $subclass) { }
10 642 elsif (exists $$self{'elem_class'} and $$self{'elem_class'}) { }
942 1220 5 unless ($$self{'__force_array_all'})
944 8 920 if $$self{'__force_array'}{$key}
945 21 899 if 1 < scalar @{$$tree{$key};}
950 752 473 if (scalar @$text) { }
28 445 elsif (not $haschild) { }
951 677 75 if (scalar @$text == 1) { }
36 39 elsif (not scalar grep({ref $_;} @$text)) { }
961 81 22 ref $_ ? :
964 12 740 if ($haschild) { }
987 29 277 if ref $$self{'__first_out'}
988 4 302 if ref $$self{'__last_out'}
989 29 277 if ref $fo
990 4 302 if ref $lo
991 29 277 if ref $fo
992 4 302 if ref $lo
993 306 0 unless (exists $$self{'use_ixhash'} and $$self{'use_ixhash'})
1002 579 339 unless ref $keys
1003 333 6 $prelen ? :
1004 333 6 $prelen ? :
1008 7 399 if (not defined $val) { }
132 267 elsif (UNIVERSAL::isa($val, 'HASH')) { }
8 259 elsif (UNIVERSAL::isa($val, 'ARRAY')) { }
50 209 elsif (UNIVERSAL::isa($val, 'SCALAR')) { }
1009 1 6 if $key eq $textnk
1026 2 207 if $ref
1040 103 41 if (defined $name and scalar @$out and not grep({not /^
1042 6 97 if (defined $$self{'__indent'})
1049 144 162 if (defined $name)
1050 126 18 if (scalar @$out) { }
1068 1 15 if (not defined $val) { }
12 3 elsif (UNIVERSAL::isa($val, 'HASH')) { }
0 3 elsif (UNIVERSAL::isa($val, 'ARRAY')) { }
0 3 elsif (UNIVERSAL::isa($val, 'SCALAR')) { }
1085 0 3 if $ref
1099 49 1 defined $$ref ? :
1102 44 6 if $name ne $$self{'text_node_key'}
1112 189 23 if $name ne $$self{'text_node_key'}
1120 0 3 unless open $fh, ">$file"
1129 2 31 unless open $fh, $file
1139 163 113 unless ($args)
1147 0 273 unless defined $$textref
1148 161 112 unless my $args = looks_like_xml($textref)
1149 6 106 unless my $getcode = ($args =~ /\s+encoding=(".*?"|'.*?')/)[0]
1157 0 435 unless my $txtref = shift()
1158 0 435 unless my $from = shift()
1159 0 435 unless my $to = shift()
1161 435 0 unless (defined $Encode::EUCJPMS::VERSION)
1162 0 435 if $from =~ /\beuc-?jp-?(win|ms)$/i
1163 0 435 if $to =~ /\beuc-?jp-?(win|ms)$/i
1167 425 10 if ($from =~ /$RE_IS_UTF8/)
1171 38 397 if exists $$self{'utf8_flag'}
1172 0 435 if (not $ALLOW_UTF8_FLAG and $setflag)
1176 435 0 if ($USE_ENCODE_PM) { }
0 0 elsif (uc $from eq 'ISO-8859-1' || uc $from eq 'US-ASCII' || uc $from eq 'LATIN-1' and uc $to eq 'UTF-8') { }
1179 0 435 $encver < 2.13 ? :
1181 435 0 if $from
1182 2 433 unless ref $encfrom
1183 433 0 if $to
1184 2 431 unless ref $encto
1186 13 418 if ($ALLOW_UTF8_FLAG and utf8::is_utf8($$txtref)) { }
1187 13 0 if ($to =~ /$RE_IS_UTF8/) { }
1194 15 403 if ($to =~ /$RE_IS_UTF8/ and $setflag) { }
1209 0 0 if uc $jfrom eq uc $jto
1210 0 0 if ($jfrom and $jto) { }
1212 0 0 if (defined $Jcode::VERSION) { }
1227 0 0 if defined $Jcode::VERSION
1233 395 40 if defined $Encode::VERSION
1250 0 0 if ($src =~ /^utf-?8$/i) { }
0 0 elsif ($src =~ /^euc.*jp(-?(win|ms))?$/i) { }
0 0 elsif ($src =~ /^(shift.*jis|cp932|windows-31j)$/i) { }
0 0 elsif ($src =~ /^iso-2022-jp/) { }
1267 1 264 unless defined $str
1288 140 45 $3 ? :
6140 185 $4 ? :
1299 12 24 $3 ? :
0 36 $4 ? :
1310 6 24 $3 ? :
0 30 $4 ? :
1317 158 27 if ($code <= 127)
1320 27 0 if scalar @_
1326 12 24 if ($code <= 127) { }
12 12 elsif ($code <= 2047) { }
12 0 elsif ($code <= 65535) { }
0 0 elsif ($code <= 1114111) { }
1338 0 0 if scalar @_