Branch Coverage

blib/lib/XML/Generator.pm
Criterion Covered Total %
branch 239 284 84.1


line true false branch
497 1 14 if (ref $type and defined $tag_factory{$type})
509 10 4 if (@_)
513 2 8 if (grep /^:stacked$/, @_)
523 7 13 if ($STACKED)
526 2 1 wantarray ? :
3 4 if @ret
533 0 17 if ($tag =~ /^xml/ and $this->{'conformance'} eq "strict")
534 0 0 if (my $func = $this->can($tag))
547 2 8 if ($STACKED and not defined *{"${pkg}::import";}{"CODE"})
566 1 57 if ref $class
577 0 7 defined $1 ? :
1 4 unless (caller 1)[3] =~ /::import/
0 109 /^filterInvalidChars$/ ? :
1 109 /^qualifiedAttributes$/ ? :
0 110 /^allowedXMLTags$/ ? :
5 110 /^:(import | stacked )$/x ? :
7 115 /^:pretty(?:=(.+))?$/x ? :
6 122 /^:strict $/x ? :
1 128 /^:(std|standard) $/x ? :
590 490 80 unless (defined $options{$_})
595 1 56 if ($options{'dtd'})
599 1 56 if ($options{'conformance'} eq "strict" and $options{'empty'} eq "ignore")
604 18 38 if ($options{'escape'}) { }
608 14 8 if ($1 eq 'always') { }
4 4 elsif ($1 eq 'high-bit') { }
1 3 elsif ($1 eq 'apos') { }
1 2 elsif ($1 eq 'even-entities') { }
2 0 elsif ($1) { }
618 0 2 if ($1 ne "unescaped")
629 1 55 if ($options{'xml'} and ref $options{'xml'} ne "HASH")
633 8 47 if (ref $options{'namespace'} eq 'ARRAY') { }
0 47 elsif ($options{'namespace'}) { }
634 0 8 if (@{$options{'namespace'};} > 2 and @{$options{'namespace'};} % 2 != 0)
641 23 32 if ($options{'conformance'} eq "strict" and $options{'filter_invalid_chars'} eq "")
658 131 0 defined our $AUTOLOAD ? :
709 0 5 unless $this->{'conformance'} eq "strict"
717 1 4 if (@_)
745 0 5 unless $this->{'conformance'} eq "strict"
783 13 5 if $this->{'conformance'} eq "strict"
784 4 1 if defined $this->{'xml'}
792 0 5 unless $this->{'conformance'} eq "strict"
800 0 10 unless $this->_allow_xml_cmd
813 2 8 $doctype ? :
816 2 4 if ($args[$i] eq 'version') { }
2 2 elsif ($args[$i] eq 'encoding') { }
2 0 elsif ($args[$i] eq 'standalone') { }
827 9 1 if defined $version
828 4 6 if defined $encoding
829 9 1 if defined $standalone
836 2 8 if $doctype
866 2 0 $dtd ? :
882 0 3 unless $this->{'conformance'} eq "strict"
907 1 7 unless $this->_allow_xml_cmd
910 1 6 unless (@_)
916 2 6 if UNIVERSAL::isa($arg, "XML::Generator::comment") or UNIVERSAL::isa($arg, "XML::Generator::pi")
918 5 1 if (UNIVERSAL::isa($arg, 'XML::Generator::overload')) { }
919 0 5 if ($got_root)
1109 30 121 if (ref $args[0] eq "ARRAY")
1110 3 49 defined $_ && $_ eq '#default' ? :
1111 0 30 if (@$namespace > 2 and @$namespace % 2 != 0)
1117 121 30 unless ($namespace)
1118 0 35 defined $_ && $_ eq '#default' ? :
99 22 unless $this->{'namespace'}
1121 25 126 if (@$namespace == 1)
1124 40 111 if (ref $args[0] eq "HASH")
1126 23 17 if ($this->{'conformance'} eq "strict")
1144 2 0 if $sub
1157 15 42 $arg->{'pretty'} ? :
0 57 $arg->{'pretty'} =~ /^[^0-9]/ ? :
1161 15 42 $indent ? :
1170 72 77 if $strict
1174 1 168 if (UNIVERSAL::isa($_, "XML::Generator::final"))
1180 73 72 if ($escape or $filter) { }
1181 24 49 if ($attr)
1183 0 26 unless defined $attr->{$key}
1185 23 3 if $filter
1189 0 121 unless defined $_
1192 2 119 if (ref $_ eq 'SCALAR') { }
88 31 elsif (not UNIVERSAL::isa($_, 'XML::Generator::overload')) { }
1196 24 64 if $escape
1197 84 4 if $filter
1203 0 47 if ref $_ eq "SCALAR"
1208 25 120 if $namespace and defined $namespace->[0]
1211 38 107 if ($attr)
1213 0 40 unless defined $k and defined $v
1214 23 17 if ($strict) { }
2 15 elsif ($this->{'qualified_attributes'}) { }
1216 4 19 if ($k =~ s/^([^:]+)://) { }
0 19 elsif ($prefix and $this->{'qualified_attributes'}) { }
1226 1 1 unless ($k =~ /^[^:]+:/)
1236 94 51 if (@args or $empty eq 'close') { }
1 50 elsif ($empty eq 'ignore') { }
1 49 elsif ($empty eq 'compact') { }
1237 1 93 if ($empty eq 'args' and @args == 1 and not defined $args[0]) { }
1241 45 48 if ($indent) { }
1245 0 57 unless defined $arg
1246 2 55 if (UNIVERSAL::isa($arg, 'XML::Generator::cdata')) { }
1251 33 22 if (UNIVERSAL::isa($arg, "XML::Generator::overload") and not UNIVERSAL::isa($arg, "XML::Generator::pi"))
1255 32 1 if ref $arg->[0]
1259 1 63 if (UNIVERSAL::isa($arg->[$i], "XML::Generator::cdata"))
1267 1 32 if (@cdata)
1276 1 1 if (defined $cdata[$i]) { }
1292 16 94 if (UNIVERSAL::isa($arg, "XML::Generator::overload") and not UNIVERSAL::isa($arg, 'XML::Generator::cdata') || UNIVERSAL::isa($arg, 'XML::Generator::pi'))
1295 15 1 if ref $arg->[0]
1310 145 0 if $namespace
1333 19 14 if (defined $n[$i]) { }
11 3 elsif (defined $n[$i + 1]) { }
1336 10 8 unless defined $namespace->[$j]
1337 7 1 if ($namespace->[$j] eq $n[$i])
1339 0 7 if ($$namespace[$j + 1] ne $n[$i + 1])
1345 12 7 if (not $flag) { }
7 0 elsif ($flag == 1) { }
1355 2 5 if defined $namespace->[$j]
1356 4 1 if ($$namespace[$j + 1] eq $n[$i + 1])
1365 0 47 if (not @{$o->[0];} || $sawDefault and grep {not defined $$namespace[$_ * 2] if defined $$namespace[$_ * 2 + 1];} 0 .. $#$namespace / 2)
1367 1 17 if defined $$namespace[$_ * 2 + 1]
1372 10 37 if (@n) { }
1386 0 0 @_ ? :
1392 3 93 unless defined $_[0]
1395 77 16 if ($f & 2) { }
1396 1 76 if ($f & 64) { }
1403 77 0 if $f & 32
1404 57 20 if $f & 16
1405 1 76 if $f & 16 and $f & 8
1411 8 8 if ($f & 32)
1415 12 4 if ($f & 16)
1418 0 12 if ($f & 8)
1424 5 88 if ($f & 4)
1440 129 1 if ($name =~ /^\w[\w\-\.]*$/) { }
1441 2 127 if ($name =~ /^\d/)
1447 3 124 if ($name =~ /^xml/i)
1448 2 1 if (not $this->{'allowed_xml_tags'} && grep({$_ eq $name;} @{$$this{'allowed_xml_tags'};}))
1463 0 1 unless ref $dtd eq "ARRAY"
1464 0 1 unless @{$dtd;} >= 3
1467 0 1 if ($type eq 'PUBLIC') { }
1 0 elsif ($type eq 'SYSTEM') { }
1474 0 1 if $DTDs{$uri}
1496 100 0 ref $_[0] ? :
0 100 ref $_[1] ? :
1505 0 198 unless UNIVERSAL::isa($_[0], "XML::Generator::overload")
1506 108 90 if (ref $_[0][0])
1513 21 24 if (defined $prefix) { }