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 14 5 if $this->{'conformance'} eq "strict"
784 4 1 if defined $this->{'xml'}
792 0 6 unless $this->{'conformance'} eq "strict"
800 0 11 unless $this->_allow_xml_cmd
816 3 6 if ($args[$i] eq 'version') { }
3 3 elsif ($args[$i] eq 'encoding') { }
3 0 elsif ($args[$i] eq 'standalone') { }
827 2 9 if $doctype
828 10 1 if defined $version
829 5 6 if defined $encoding
830 4 7 if defined $standalone
837 2 9 if $doctype
867 2 0 $dtd ? :
883 0 3 unless $this->{'conformance'} eq "strict"
908 1 7 unless $this->_allow_xml_cmd
911 1 6 unless (@_)
917 2 6 if UNIVERSAL::isa($arg, "XML::Generator::comment") or UNIVERSAL::isa($arg, "XML::Generator::pi")
919 5 1 if (UNIVERSAL::isa($arg, 'XML::Generator::overload')) { }
920 0 5 if ($got_root)
1110 30 121 if (ref $args[0] eq "ARRAY")
1111 3 49 defined $_ && $_ eq '#default' ? :
1112 0 30 if (@$namespace > 2 and @$namespace % 2 != 0)
1118 121 30 unless ($namespace)
1119 0 35 defined $_ && $_ eq '#default' ? :
99 22 unless $this->{'namespace'}
1122 25 126 if (@$namespace == 1)
1125 40 111 if (ref $args[0] eq "HASH")
1127 23 17 if ($this->{'conformance'} eq "strict")
1145 2 0 if $sub
1158 15 42 $arg->{'pretty'} ? :
0 57 $arg->{'pretty'} =~ /^[^0-9]/ ? :
1162 15 42 $indent ? :
1171 72 77 if $strict
1175 1 168 if (UNIVERSAL::isa($_, "XML::Generator::final"))
1181 73 72 if ($escape or $filter) { }
1182 24 49 if ($attr)
1184 0 26 unless defined $attr->{$key}
1186 23 3 if $filter
1190 0 121 unless defined $_
1193 2 119 if (ref $_ eq 'SCALAR') { }
88 31 elsif (not UNIVERSAL::isa($_, 'XML::Generator::overload')) { }
1197 24 64 if $escape
1198 84 4 if $filter
1204 0 47 if ref $_ eq "SCALAR"
1209 25 120 if $namespace and defined $namespace->[0]
1212 38 107 if ($attr)
1214 0 40 unless defined $k and defined $v
1215 23 17 if ($strict) { }
2 15 elsif ($this->{'qualified_attributes'}) { }
1217 4 19 if ($k =~ s/^([^:]+)://) { }
0 19 elsif ($prefix and $this->{'qualified_attributes'}) { }
1227 1 1 unless ($k =~ /^[^:]+:/)
1237 94 51 if (@args or $empty eq 'close') { }
1 50 elsif ($empty eq 'ignore') { }
1 49 elsif ($empty eq 'compact') { }
1238 1 93 if ($empty eq 'args' and @args == 1 and not defined $args[0]) { }
1242 45 48 if ($indent) { }
1246 0 57 unless defined $arg
1247 2 55 if (UNIVERSAL::isa($arg, 'XML::Generator::cdata')) { }
1252 33 22 if (UNIVERSAL::isa($arg, "XML::Generator::overload") and not UNIVERSAL::isa($arg, "XML::Generator::pi"))
1256 32 1 if ref $arg->[0]
1260 1 63 if (UNIVERSAL::isa($arg->[$i], "XML::Generator::cdata"))
1268 1 32 if (@cdata)
1277 1 1 if (defined $cdata[$i]) { }
1293 16 94 if (UNIVERSAL::isa($arg, "XML::Generator::overload") and not UNIVERSAL::isa($arg, 'XML::Generator::cdata') || UNIVERSAL::isa($arg, 'XML::Generator::pi'))
1296 15 1 if ref $arg->[0]
1311 145 0 if $namespace
1334 19 14 if (defined $n[$i]) { }
11 3 elsif (defined $n[$i + 1]) { }
1337 10 8 unless defined $namespace->[$j]
1338 7 1 if ($namespace->[$j] eq $n[$i])
1340 0 7 if ($$namespace[$j + 1] ne $n[$i + 1])
1346 12 7 if (not $flag) { }
7 0 elsif ($flag == 1) { }
1356 2 5 if defined $namespace->[$j]
1357 4 1 if ($$namespace[$j + 1] eq $n[$i + 1])
1366 0 47 if (not @{$o->[0];} || $sawDefault and grep {not defined $$namespace[$_ * 2] if defined $$namespace[$_ * 2 + 1];} 0 .. $#$namespace / 2)
1368 1 17 if defined $$namespace[$_ * 2 + 1]
1373 10 37 if (@n) { }
1387 0 0 @_ ? :
1393 3 93 unless defined $_[0]
1396 77 16 if ($f & 2) { }
1397 1 76 if ($f & 64) { }
1404 77 0 if $f & 32
1405 57 20 if $f & 16
1406 1 76 if $f & 16 and $f & 8
1412 8 8 if ($f & 32)
1416 12 4 if ($f & 16)
1419 0 12 if ($f & 8)
1425 5 88 if ($f & 4)
1441 129 1 if ($name =~ /^\w[\w\-\.]*$/) { }
1442 2 127 if ($name =~ /^\d/)
1448 3 124 if ($name =~ /^xml/i)
1449 2 1 if (not $this->{'allowed_xml_tags'} && grep({$_ eq $name;} @{$$this{'allowed_xml_tags'};}))
1464 0 1 unless ref $dtd eq "ARRAY"
1465 0 1 unless @{$dtd;} >= 3
1468 0 1 if ($type eq 'PUBLIC') { }
1 0 elsif ($type eq 'SYSTEM') { }
1475 0 1 if $DTDs{$uri}
1497 100 0 ref $_[0] ? :
0 100 ref $_[1] ? :
1506 0 198 unless UNIVERSAL::isa($_[0], "XML::Generator::overload")
1507 108 90 if (ref $_[0][0])
1514 21 24 if (defined $prefix) { }