Branch Coverage

blib/lib/XML/Loy.pm
Criterion Covered Total %
branch 167 196 85.2


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 3009 20 if (&blessed($class)) { }
112 530 2499 if ($class->can("ON_INIT"))
127 20 613 do { index($_[0], ' ') >= 0 unless index($_[0], '<') >= 0 } ? :
1 633 do { ref $_[0] } ? :
634 2372 $_[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 0 203 if (index($tag, "loy:") == 0)
220 19 184 if (index($tag, "-") == 0)
226 0 184 unless $tree->[0] eq "tag"
233 27 157 if ($caller ne $class and $caller->can("_prefix"))
234 27 0 if (my $prefix = $caller->_prefix and $caller->_namespace)
251 49 60 if (not $self->parent and $self->tree->[1][0] eq "pi")
256 37 72 if (ref $_[0]) { }
267 0 72 if (index($tag, 'loy:') == 0) { }
0 72 elsif (index($tag, '-') == 0) { }
282 25 47 if ($caller ne $class and $caller->can("_prefix"))
283 25 0 if (my $prefix = $caller->_prefix and $caller->_namespace)
296 33 76 if (index($att->{'loy:once'}, "($tag)") >= 0) { }
308 72 37 unless &blessed($_[0])
325 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")
335 151 319 $type ? :
336 2 468 $tree->[0] eq 'root' ? :
339 114 1936 unless $e->[0] eq "tag"
342 788 1148 if (defined $type)
345 718 70 if (index($type, ':') > 0 or index($e->[1], ':') < 0) { }
70 0 elsif (index($e->[1], ':') > 0) { }
346 576 142 if $e->[1] ne $type
351 42 28 if substr($e->[1], index($e->[1], ":") + 1) ne $type
368 45 268 if (ref $_[0]) { }
387 39 6 if (exists $root_attr->{'xmlns'})
390 39 0 if (my $ns = $self->namespace)
391 38 1 if $root_attr->{'xmlns'} eq $ns
399 0 45 if (exists $root_attr->{'loy:ext'})
409 43 2 if (ref $sec eq "ARRAY" and $sec->[0] eq "pi")
425 2 266 unless $name =~ /^-?[^\s<>]+$/u
427 105 161 if ref $_[0] eq "HASH"
430 19 247 if (index($name, "-") == 0)
437 159 107 if (defined $text) { }
453 105 161 if ($att)
463 6 260 if $comment
489 0 23 unless $parent = $self->parent
496 23 129 if $e eq $self->tree
504 7 16 if ($previous and $previous->[0] eq 'comment') { }
526 1 166 unless ($root)
534 147 19 unless $_[0]
542 4 20 if grep {$ext eq $_;} @ext
545 9 11 if (index($ext, "-") == 0)
550 0 20 if (my $e = load_class($ext))
551 0 0 if ref $e
562 20 0 if (my $n_ns = $ext->_namespace and my $n_pref = $ext->_prefix)
580 102 580 unless ($_[0])
591 0 580 unless $root
594 577 3 $prefix ? :
607 1 2 if (index($base, "-") == 0)
617 0 3 if (my $e = load_class($base))
618 0 0 if ref $e
630 3 0 if ($base->_namespace)
664 0 348 unless $e
667 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') { }
684 0 5 unless $_
728 0 172 unless $qname =~ /^(?:[a-zA-Z_]+:)?[^\s]+$/u
738 98 74 if ($child->[0]) { }
744 56 42 if (not $child->[1] and ($child->[0] and $child->[0][0] eq 'text')) { }
3 39 elsif (exists $attr->{'loy:type'}) { }
747 5 51 if (exists $attr->{'loy:type'}) { }
750 3 2 if ($attr->{'loy:type'} =~ /^armour(?::(\d+))?$/iu) { }
784 1 2 if ($attr->{'loy:type'} eq 'raw') { }
2 0 elsif ($attr->{'loy:type'} eq 'escape') { }
824 4 35 if (not exists $attr->{'loy:type'} and $child->[0] and $child->[0][0] eq "text")
868 121 68 unless $_ eq "xmlns:loy"
878 67 105 if (keys %attr)
895 0 980 unless my $root = $self->tree
899 778 202 if ($root->[0] eq 'root') { }
916 0 377 unless my $parent = $root->[3]
947 17 138 unless $_->can($method)
955 3 2 if (@ext)
956 1 2 @ext > 1 ? :
960 5 0 if carp($errstr)