Branch Coverage

blib/lib/XML/Loy.pm
Criterion Covered Total %
branch 163 190 85.7


line true false branch
51 27 31 unless my $flag = shift()
53 1 30 unless $flag =~ /^-?(?i:base|with)$/u
63 29 1 if (@_)
70 72 15 if (exists $param{$_})
76 3 26 if (exists $param{'on_init'})
92 512 188 unless ${"$_[0]::NAMESPACE";}
93 0 72 unless ${"$_[0]::PREFIX";}
95 6 4 unless ${(&blessed($_[0]) || $_[0]) . '::MIME';}
102 3007 20 if (&blessed($class)) { }
112 530 2497 if ($class->can('ON_INIT'))
127 20 613 do { index($_[0], ' ') >= 0 unless index($_[0], '<') >= 0 } ? :
1 633 do { ref $_[0] } ? :
634 2370 $_[0] ? :
137 613 20 unless index($_[0], '<') >= 0
144 53 560 ref $_[0] eq 'HASH' ? :
150 613 0 if $att
159 2 611 if $comment
168 41 572 if defined $text
177 582 31 if ($class ne 'XML::Loy')
180 70 512 if (my $ns = $class->_namespace)
202 115 2 if (not $self->parent and ref $self->tree->[1] and ref $self->tree->[1] eq 'ARRAY' and $self->tree->[1][0] eq 'pi')
210 1 203 unless my $element = $self->_add_clean(@_)
215 19 184 if (index($tag, '-') == 0)
221 0 184 unless $tree->[0] eq 'tag'
228 27 157 if ($caller ne $class and $caller->can('_prefix'))
229 27 0 if (my $prefix = $caller->_prefix and $caller->_namespace)
246 49 60 if (not $self->parent and $self->tree->[1][0] eq 'pi')
251 37 72 if (ref $_[0]) { }
262 0 72 if (index($tag, '-') == 0) { }
273 25 47 if ($caller ne $class and $caller->can('_prefix'))
274 25 0 if (my $prefix = $caller->_prefix and $caller->_namespace)
287 33 76 if (index($att->{'loy:once'}, "($tag)") >= 0) { }
299 72 37 unless &blessed($_[0])
316 36 2 if (not $self->parent and ref $self->tree->[1] and ref $self->tree->[1] eq 'ARRAY' and $self->tree->[1][0] eq 'pi')
326 151 319 $type ? :
327 2 468 $tree->[0] eq 'root' ? :
330 114 1936 unless $e->[0] eq 'tag'
333 788 1148 if (defined $type)
336 718 70 if (index($type, ':') > 0 or index($e->[1], ':') < 0) { }
70 0 elsif (index($e->[1], ':') > 0) { }
337 576 142 if $e->[1] ne $type
342 42 28 if substr($e->[1], index($e->[1], ':') + 1) ne $type
359 45 268 if (ref $_[0]) { }
378 39 6 if (exists $root_attr->{'xmlns'})
381 39 0 if (my $ns = $self->namespace)
382 38 1 if $root_attr->{'xmlns'} eq $ns
390 0 45 if (exists $root_attr->{'loy:ext'})
400 43 2 if (ref $sec eq 'ARRAY' and $sec->[0] eq 'pi')
416 2 266 unless $name =~ /^-?[^\s<>]+$/u
418 105 161 if ref $_[0] eq 'HASH'
424 159 107 if (defined $text) { }
440 105 161 if ($att)
450 6 260 if $comment
476 0 23 unless $parent = $self->parent
483 23 129 if $e eq $self->tree
491 7 16 if ($previous and $previous->[0] eq 'comment') { }
513 1 166 unless ($root)
521 147 19 unless $_[0]
529 4 20 if grep {$ext eq $_;} @ext
532 9 11 if (index($ext, '-') == 0)
537 0 20 if (my $e = load_class($ext))
538 0 0 if ref $e
549 20 0 if (my $n_ns = $ext->_namespace and my $n_pref = $ext->_prefix)
567 102 580 unless ($_[0])
578 0 580 unless $root
581 577 3 $prefix ? :
594 1 2 if (index($base, '-') == 0)
604 0 3 if (my $e = load_class($base))
605 0 0 if ref $e
617 3 0 if ($base->_namespace)
651 0 348 unless $e
654 172 176 if ($e eq 'tag') { }
5 171 elsif ($e eq 'text') { }
31 140 elsif ($e eq 'comment') { }
69 71 elsif ($e eq 'pi') { }
71 0 elsif ($e eq 'root') { }
671 0 5 unless $_
715 0 172 unless $qname =~ /^(?:[a-zA-Z_]+:)?[^\s]+$/u
725 98 74 if ($child->[0]) { }
731 56 42 if (not $child->[1] and ($child->[0] and $child->[0][0] eq 'text')) { }
3 39 elsif (exists $attr->{'loy:type'}) { }
734 5 51 if (exists $attr->{'loy:type'}) { }
737 3 2 if ($attr->{'loy:type'} =~ /^armour(?::(\d+))?$/iu) { }
771 1 2 if ($attr->{'loy:type'} eq 'raw') { }
2 0 elsif ($attr->{'loy:type'} eq 'escape') { }
811 4 35 if (not exists $attr->{'loy:type'} and $child->[0] and $child->[0][0] eq 'text')
855 121 68 unless $_ eq 'xmlns:loy'
865 67 105 if (keys %attr)
882 0 980 unless my $root = $self->tree
886 778 202 if ($root->[0] eq 'root') { }
903 0 377 unless my $parent = $root->[3]
934 17 138 unless $_->can($method)
942 3 2 if (@ext)
943 1 2 @ext > 1 ? :
947 5 0 if carp($errstr)