Branch Coverage

lib/XML/Compile/Translate/Reader.pm
Criterion Covered Total %
branch 358 502 71.3


line true false branch
47 0 3 unless defined $action
49 1 2 if (not ref $action) { }
1 1 elsif (ref $action eq 'CODE') { }
52 0 1 unless keys %{$class . '::';}
56 0 1 unless $class->can('fromXML')
69 0 1 unless $object->can('fromXML')
86 0 397 if (&blessed($_[0]) and $_[0]->isa('XML::LibXML::Iterator')) { }
90 1 396 unless my $xml = 'XML::Compile'->dataToXML($_[0])
92 0 396 if $xml->isa('XML::LibXML::Document')
99 0 328 unless (defined $data)
112 0 4 unless ref $attr and $attr->isa('XML::LibXML::Attr')
134 86 134 if (@pairs == 2)
139 61 7 $_[0] && $_[0]->currentType eq $take ? :
6 80 ref $action eq 'BLOCK' || ref $action eq 'ANY' ? :
150 285 46 ref $do eq 'BLOCK' || ref $do eq 'ANY' || defined $tree && $tree->currentType eq $take ? :
165 12 79 if ref $do{$el} eq 'BLOCK' or ref $do{$el} eq 'ANY'
168 4 36 if (keys %do == 1 and not @specials)
172 4 0 defined $tree ? :
173 3 1 if $type eq $option
177 0 1 unless $@
179 1 0 unless $type
191 37 0 defined $tree ? :
192 37 0 defined $type ? :
193 33 4 if $elem
199 1 7 unless $@
203 1 2 unless $type
209 26 10 unless @specials
213 10 0 defined $tree ? :
214 10 0 defined $type ? :
215 4 6 if $elem
220 6 0 if not $@ and @d
221 0 0 if $@
226 0 0 unless $@
230 0 0 unless $type
235 0 0 if @elems
248 3 77 if ref $pairs{$el} eq 'BLOCK' or ref $pairs{$el} eq 'ANY'
251 5 25 if (not %specials and keys %pairs == 1)
255 3 1 $tree && $tree->currentType eq $take ? :
264 21 46 unless my $type = $tree && $tree->currentType
265 1 45 unless my $do = delete $do{$type}
274 22 3 unless keys %specials
285 2 9 unless my $type = $tree->currentType
286 6 3 if (my $do = delete $do{$type})
292 0 3 if $spseen{$_}
294 1 2 if $@
303 0 3 unless @res
310 2 1 $spseen{$_} ? :
321 269 30 if ($max ne 'unbounded' and $max == 1)
323 264 5 if $min == 1
326 0 5 unless my $tree = shift()
327 1 4 unless my $starter = $tree->currentChild
329 2 2 if ($@->wasFatal('class', 'misfit')) { }
0 2 elsif ($@) { }
331 1 1 if not $ending or $ending != $starter
340 0 30 if ($max ne 'unbounded' and $min >= $max)
353 18 12 if ($min == 0)
355 0 18 unless my $tree = shift()
358 11 35 unless my $starter = $tree->currentChild
360 3 32 if ($@->wasFatal('class', 'misfit')) { }
0 32 elsif ($@) { }
364 0 3 if not $ending or $ending != $starter
369 3 29 unless @pairs
373 14 4 @res ? :
379 0 10 unless my $tree = shift()
390 6 12 unless my $starter = $tree->currentChild
392 0 12 if ($@->wasFatal('class', 'misfit')) { }
0 12 elsif ($@) { }
396 0 0 if not $ending or $ending != $starter
401 0 12 unless @pairs
412 1 521 if $max eq '0'
414 495 26 if ($max ne 'unbounded' and $max == 1)
417 335 39 defined $tree ? :
418 331 8 if defined $tree
421 30 53 unless my $tree = shift()
422 0 53 unless $tree->currentChild
425 0 52 unless @pairs
427 424 71 $min == 1 ? :
430 2 24 if ($max ne 'unbounded' and $min >= $max)
435 4 0 defined $tree ? :
437 3 0 if defined $tree
439 1 0 @res ? :
443 22 2 unless (defined $required)
445 6 16 unless my $tree = shift()
448 10 40 unless $tree->currentChild
450 6 34 unless @pairs
454 16 0 @res ? :
461 2 0 defined $tree ? :
463 2 0 if defined $tree
466 0 2 unless $tree->currentChild
468 1 1 unless @pairs
483 31 344 unless @pairs
487 0 429 ref $do eq 'BLOCK' ? :
495 0 0 if defined $tree and $tree->nodeType eq $childname and $tree->node->hasAttribute('href')
507 816 38 defined $tree && $tree->nodeType eq $childname ? :
509 744 37 defined $value ? :
519 0 2 unless my $tree = shift()
520 0 2 if $tree->nodeType ne $childname or $tree->node->textContent eq ''
523 2 17 if $mode eq 'IGNORE'
530 1 7 if not defined $tree or $tree->nodeType ne $childname or $tree->node->textContent eq ''
536 14 3 if $mode eq 'EXTEND'
540 0 3 unless my $tree = shift()
541 0 3 if $tree->nodeType ne $childname or $tree->node->textContent eq ''
544 1 2 if defined $v and $v eq $def
546 3 0 if $mode eq 'MINIMAL'
556 2 1 $tree && $tree->nodeType eq $childname ? :
559 1 2 unless defined $value
562 0 2 unless $value eq $fix
573 1 2 unless my $tree = shift()
574 0 2 unless $tree->nodeType eq $childname
603 0 10 unless my $tree = shift()
605 5 5 $tree->nodeNil ? :
610 0 10 if $tree->currentChild
614 6 256 if $is_nillable
617 1 60 unless my $tree = shift()
621 0 56 if $tree->currentChild
625 57 199 if @elems > 1 or @attrs
628 0 8 unless my $tree = shift()
629 0 8 if $tree->currentChild
633 10 189 unless @elems
636 0 185 unless my $tree = shift()
639 4 152 if $tree->currentChild
655 1 10 $is_nillable && ref $tree && $tree->nodeNil ? :
656 1 10 unless ref $tree
659 10 0 defined $simple || @pairs ? :
671 0 6 unless my $mixed = $self->{'mixed_elements'}
672 0 6 if $is_nillable
675 0 1 unless my $tree = shift()
676 0 1 unless my $node = $tree->node
678 1 0 @v ? :
682 1 0 $_[0] ? :
685 0 2 unless my $tree = shift()
692 0 1 unless my $tree = shift()
699 0 1 unless my $tree = shift()
700 0 1 unless my $node = $tree->node
703 0 0 $mixed eq 'STRUCTURAL' ? :
1 0 $mixed eq 'XML_STRING' ? :
1 1 $mixed eq 'TEXTUAL' ? :
2 2 $mixed eq 'ATTRIBUTES' ? :
1 4 $mixed eq 'XML_NODE' ? :
1 5 ref $mixed eq 'CODE' ? :
720 9 5 ref $tree && $tree->nodeNil ? :
721 14 0 defined $value ? :
724 521 35 defined $value ? :
725 14 639 $is_nillable ? :
731 0 1 unless ref $node
732 0 1 &first(sub { UNIVERSAL::isa($_, 'XML::LibXML::Element'); } , $node->childNodes) ? :
739 8 788 if ($type =~ /}anyType$/)
741 1 7 if (my $a = $self->{'any_type'}) { }
743 1 0 ref $_[0] && UNIVERSAL::isa($_[0], 'XML::Compile::Iterator') ? :
750 0 7 unless ref $_[0]
751 5 2 UNIVERSAL::isa($_[0], 'XML::Compile::Iterator') ? :
754 1 6 &first(sub { UNIVERSAL::isa($_, 'XML::LibXML::Element'); } , $node->childNodes) ? :
759 788 0 $check_values ? :
761 1 787 $path eq $type ? :
767 565 100 ref $_[0] ? :
768 36 629 unless defined $value
769 617 12 if &$check($value)
773 0 0 ref $_[0] ? :
774 0 0 unless defined $value
775 0 0 if &$check($value)
781 7 6 ref $_[0] ? :
782 0 13 unless defined $value
785 46 9 ref $_[0] ? :
786 697 0 defined $parse ? :
10 81 defined $parse ? :
697 91 $check ? :
792 25 2 ref $tree ? :
0 27 UNIVERSAL::isa($tree, 'XML::LibXML::Node') ? :
795 25 2 ref $tree ? :
810 7 4 unless @e
812 0 4 unless defined $_[0]
813 4 0 ref $_[0] ? :
823 1 93 unless @$early or @$late
825 79 14 unless (@$early)
828 0 72 unless defined $v
836 12 0 if (@$early)
837 0 12 unless defined $v
849 23 16 unless $@
850 2 1 ref $tree ? :
852 0 3 if length $text > 50
863 1 11 unless defined $node
867 0 11 unless defined $node
869 11 0 defined $value ? :
876 2 1 unless defined $node
886 22 70 unless defined $node
888 68 0 defined $val ? :
899 2 1 defined $node ? :
2 5 if $mode eq 'IGNORE'
906 2 2 $node ? :
907 3 2 if $mode eq 'EXTEND'
912 2 1 $node ? :
913 2 1 !defined($v) || $v eq $def ? :
914 2 0 if $mode eq 'MINIMAL'
923 1 4 unless my $node = $_[0]->getAttributeNodeNS($ns, $tag)
927 1 3 unless defined $value and $value eq $def
939 0 9 unless keys %do
943 14 0 $tree ? :
0 14 unless my $type = $tree ? $tree->currentType : undef
947 3 11 unless my $do = $do{$type}
949 0 10 unless @subst
960 1 4 unless defined $handler
962 3 1 unless $yes
963 1 3 unless $no
969 8 8 unless $attr->isa('XML::LibXML::Attr')
971 1 7 if keys %yes and not $yes{$ns}
972 1 1 if keys %no and $no{$ns}
990 1 1 if defined $label
993 0 1 ref $handler ne 'CODE' ? :
3 1 $handler eq 'TAKE_ALL' ? :
1004 3 2 unless $yes
1005 2 3 unless $no
1010 0 5 unless my $tree = shift()
1016 1 1 if keys %yes
1017 1 1 if keys %no
1025 0 5 unless $count >= $min
1032 0 0 unless my $tree = shift()
1033 0 0 unless my $child = $tree->currentChild
1036 0 0 unless !keys(%yes) || $yes{$ns} and not keys %no && $no{$ns}
1041 5 0 $max eq 'unbounded' || $max > 1 ? :
1060 0 0 if defined $label
1063 0 0 ref $handler ne 'CODE' ? :
1 0 $handler eq 'SKIP_ALL' ? :
4 1 $handler eq 'TAKE_ALL' ? :
1074 0 7 unless my $tree = shift()
1075 0 7 unless my $node = $tree->node
1078 6 1 if ($type) { }
1079 0 6 $type =~ /(.*?)\:(.*)/ ? :
1081 0 6 unless $code = $types->{$alt}
1090 1 6 unless defined $t
1092 0 6 if ref $d ne 'HASH'
1102 0 8 unless $before or $replace or $after
1105 1 10 if $replace and grep(($_ eq 'SKIP'), @$replace)
1107 0 10 $replace ? :
1108 3 7 $before ? :
1109 10 0 $after ? :
1114 0 10 unless my $tree = shift()
1118 0 3 unless defined $xml
1122 0 10 @replace ? :
1126 0 10 unless @h
1127 0 10 @h == 1 ? :
1130 0 13 unless defined $h
1138 3 0 if ref $call eq 'CODE'
1141 0 0 $call eq 'PRINT_PATH' ? :
1146 0 0 if ref $call eq 'CODE'
1149 0 0 $call eq 'XML_NODE' ? :
1186 7 6 if ref $call eq 'CODE'
1190 0 6 unless my $dec = $after{$call}
1217 6 0 $class eq 'ref' ? :
2 6 $class eq 'complexType' ? :
2 8 $class eq 'simpleType' ? :
9 10 $class eq 'anyType' ? :