Branch Coverage

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


line true false branch
469 4 13 if $$self{'ignore_error'}
476 0 2 if $$self{'ignore_error'}
484 31 3 if (defined $val) { }
495 0 0 if exists $$self{$key}
501 0 3 unless my $tree = shift()
503 0 3 unless defined $file
505 1 2 if ($ALLOW_UTF8_FLAG and utf8::is_utf8($text))
513 3 165 unless my $tree = shift()
517 163 2 unless defined $decl
520 6 159 if (exists $$self{'first_out'})
522 0 6 unless ref $keys
527 2 163 if (exists $$self{'last_out'})
529 0 2 unless ref $keys
533 3 162 if exists $$self{'text_node_key'}
534 29 136 unless defined $tnk
537 8 157 if exists $$self{'attr_prefix'}
538 28 137 unless defined $apre
543 2 163 if (exists $$self{'indent'} and $$self{'indent'})
547 3 162 unless (UNIVERSAL::isa($tree, 'HASH'))
552 162 0 if ($from and $to)
554 0 160 unless $stat
557 1 159 if $decl eq ''
565 0 0 if (exists $$self{'user_agent'}) { }
567 0 0 if $agent =~ /\s$/s
568 0 0 if $agent ne ''
574 0 0 unless ($http)
578 0 0 if ($http eq 'LWP::UserAgent') { }
0 0 elsif ($http eq 'HTTP::Lite') { }
592 0 0 if (exists $$self{'lwp_useragent'} and ref $$self{'lwp_useragent'})
593 0 0 if defined $LWP::UserAgent::VERSION
594 0 0 if &load_lwp_useragent()
598 0 0 if (exists $$self{'http_lite'} and ref $$self{'http_lite'})
599 0 0 if defined $HTTP::Lite::VERSION
600 0 0 if &load_http_lite()
604 0 0 if defined $LWP::UserAgent::VERSION
605 0 0 if defined $HTTP::Lite::VERSION
606 0 0 if &load_lwp_useragent()
607 0 0 if &load_http_lite()
612 0 0 if defined $LWP::UserAgent::VERSION
619 0 0 if defined $HTTP::Lite::VERSION
626 0 0 if defined $Tie::IxHash::VERSION
634 0 0 unless my $method = shift()
635 0 0 unless my $url = shift()
639 0 0 if exists $$self{'lwp_useragent'}
640 0 0 if (not ref $ua) { }
643 0 0 if defined $$self{'__user_agent'}
645 0 0 if exists $$self{'user_agent'}
650 0 0 if (ref $header)
654 0 0 if $field =~ /^Content-Type$/i
657 0 0 if (defined $body and not $ct)
660 0 0 if defined $body
664 0 0 if ($res->can('decoded_content')) { }
669 0 0 if $res->is_success
670 0 0 wantarray ? :
675 0 0 unless my $method = shift()
676 0 0 unless my $url = shift()
683 0 0 if (ref $header)
687 0 0 if $field =~ /^User-Agent$/i
690 0 0 if (defined $$self{'__user_agent'} and not $ua)
693 0 0 if defined $body
694 0 0 unless my $code = $http->request($url)
697 0 0 wantarray ? :
703 0 33 unless defined $file
710 32 242 ref $_[0] ? :
711 1 273 unless defined $text
715 273 0 if ($from and $to)
717 0 271 unless $stat
722 7 264 if (exists $$self{'force_array'})
724 1 6 unless ref $force
731 2 269 if (exists $$self{'force_hash'})
733 1 1 unless ref $force
738 3 268 if exists $$self{'text_node_key'}
739 34 237 unless defined $tnk
742 8 263 if exists $$self{'attr_prefix'}
743 35 236 unless defined $apre
746 0 271 if (exists $$self{'use_ixhash'} and $$self{'use_ixhash'})
747 0 0 unless &load_tie_ixhash()
751 3 268 if (exists $$self{'require_xml_decl'} and $$self{'require_xml_decl'})
752 2 1 unless looks_like_xml(\$text)
756 1 268 if exists $$self{'base_class'}
758 268 0 if (ref $tree)
759 1 267 if (defined $class) { }
1 532 elsif (exists $$self{'elem_class'} and $$self{'elem_class'}) { }
766 0 268 wantarray ? :
778 13 256 if ($xml_deref)
779 7 6 if (exists $$self{'utf8_flag'} and $$self{'utf8_flag'} or $ALLOW_UTF8_FLAG and utf8::is_utf8($$textref)) { }
808 0 2358 if (defined $ahead and $ahead =~ /\S/)
813 2043 315 if ($typeElem) { }
177 138 elsif ($typeCDATA) { }
28 110 elsif ($typeCmnt) { }
0 110 elsif ($typeDocT) { }
110 0 elsif ($typePI) { }
815 960 1083 if ($contElem =~ s[^/][]) { }
123 960 elsif ($contElem =~ s[/$][]) { }
824 2043 0 if $contElem =~ s/^(\S+)\s*//
825 1083 960 unless ($$node{'endTag'})
831 329 24 $2 ? :
832 235 118 unless (ref $attr)
834 0 235 if $ixhash
838 235 848 if ref $attr
843 114 63 if (exists $$self{'cdata_scalar_ref'} and $$self{'cdata_scalar_ref'}) { }
859 698 1660 if ($follow =~ /\S/)
875 0 1229 if (exists $$self{'use_ixhash'} and $$self{'use_ixhash'})
881 875 2042 if (not ref $node or UNIVERSAL::isa($node, 'SCALAR'))
886 959 1083 if ($$node{'endTag'})
887 957 2 if $parent eq $name
893 15 1068 if (defined $class)
898 960 123 if ($$node{'startTag'}) { }
2 242 elsif ($forcehash and not ref $elem) { }
900 1 957 unless defined $child
901 123 834 if ref $elem
902 189 768 if (UNIVERSAL::isa($child, 'HASH')) { }
903 92 97 if ($hasattr) { }
913 31 737 if ($hasattr) { }
7 730 elsif ($forcehash) { }
931 341 739 if (ref $elem and UNIVERSAL::isa($elem, 'HASH'))
932 10 331 if (defined $subclass) { }
10 642 elsif (exists $$self{'elem_class'} and $$self{'elem_class'}) { }
945 1220 5 unless ($$self{'__force_array_all'})
947 8 920 if $$self{'__force_array'}{$key}
948 21 899 if 1 < scalar @{$$tree{$key};}
953 752 473 if (scalar @$text) { }
28 445 elsif (not $haschild) { }
954 677 75 if (scalar @$text == 1) { }
36 39 elsif (not scalar grep({ref $_;} @$text)) { }
964 81 22 ref $_ ? :
967 12 740 if ($haschild) { }
990 29 277 if ref $$self{'__first_out'}
991 4 302 if ref $$self{'__last_out'}
992 29 277 if ref $fo
993 4 302 if ref $lo
994 29 277 if ref $fo
995 4 302 if ref $lo
996 306 0 unless (exists $$self{'use_ixhash'} and $$self{'use_ixhash'})
1005 579 339 unless ref $keys
1006 333 6 $prelen ? :
1007 333 6 $prelen ? :
1011 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')) { }
1012 1 6 if $key eq $textnk
1029 2 207 if $ref
1043 103 41 if (defined $name and scalar @$out and not grep({not /^
1045 6 97 if (defined $$self{'__indent'})
1052 144 162 if (defined $name)
1053 126 18 if (scalar @$out) { }
1071 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')) { }
1088 0 3 if $ref
1102 49 1 defined $$ref ? :
1105 44 6 if $name ne $$self{'text_node_key'}
1115 189 23 if $name ne $$self{'text_node_key'}
1123 0 3 unless open $fh, ">$file"
1132 2 31 unless open $fh, $file
1142 163 113 unless ($args)
1150 0 273 unless defined $$textref
1151 161 112 unless my $args = looks_like_xml($textref)
1152 6 106 unless my $getcode = ($args =~ /\s+encoding=(".*?"|'.*?')/)[0]
1160 0 435 unless my $txtref = shift()
1161 0 435 unless my $from = shift()
1162 0 435 unless my $to = shift()
1164 435 0 unless (defined $Encode::EUCJPMS::VERSION)
1165 0 435 if $from =~ /\beuc-?jp-?(win|ms)$/i
1166 0 435 if $to =~ /\beuc-?jp-?(win|ms)$/i
1170 425 10 if ($from =~ /$RE_IS_UTF8/)
1174 38 397 if exists $$self{'utf8_flag'}
1175 0 435 if (not $ALLOW_UTF8_FLAG and $setflag)
1179 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') { }
1182 0 435 $encver < 2.13 ? :
1184 435 0 if $from
1185 2 433 unless ref $encfrom
1186 433 0 if $to
1187 2 431 unless ref $encto
1189 13 418 if ($ALLOW_UTF8_FLAG and utf8::is_utf8($$txtref)) { }
1190 13 0 if ($to =~ /$RE_IS_UTF8/) { }
1197 15 403 if ($to =~ /$RE_IS_UTF8/ and $setflag) { }
1212 0 0 if uc $jfrom eq uc $jto
1213 0 0 if ($jfrom and $jto) { }
1215 0 0 if (defined $Jcode::VERSION) { }
1230 0 0 if defined $Jcode::VERSION
1236 395 40 if defined $Encode::VERSION
1253 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/) { }
1270 1 264 unless defined $str
1291 140 45 $3 ? :
6140 185 $4 ? :
1302 12 24 $3 ? :
0 36 $4 ? :
1313 6 24 $3 ? :
0 30 $4 ? :
1320 158 27 if ($code <= 127)
1323 27 0 if scalar @_
1329 12 24 if ($code <= 127) { }
12 12 elsif ($code <= 2047) { }
12 0 elsif ($code <= 65535) { }
0 0 elsif ($code <= 1114111) { }
1341 0 0 if scalar @_