Branch Coverage

blib/lib/XML/Mini/Document.pm
Criterion Covered Total %
branch 79 184 42.9


line true false branch
41 0 9 if (defined $string)
68 0 0 unless $self->isElement($root)
81 0 0 unless $type
83 0 0 unless $type =~ /^XML::Mini::Element/
95 0 0 unless $type
97 0 0 unless $type =~ /^XML::Mini::Node/
110 0 1 unless $newElement
113 0 1 if (defined $value)
128 0 4 if ($XML::Mini::Debug)
130 0 0 if ($element) { }
149 0 4 if ($XML::Mini::Debug)
151 0 0 if ($element) { }
168 12 0 if ($XML::Mini::CheckXMLBeforeParsing)
184 157 693 unless exists $counts{$1}{'open'}
190 156 692 unless exists $counts{$1}{'close'}
198 1 156 unless ($$res{'open'} and $$res{'close'} and $$res{'open'} == $$res{'close'})
205 1 11 if (scalar @unmatched)
207 0 1 if ($XML::Mini::DieOnBadXML) { }
234 1 8 if (ref $filename and UNIVERSAL::isa($filename, 'IO::Handle')) { }
1 7 elsif (ref $fRef eq 'GLOB') { }
7 0 elsif (ref $fRef eq 'SCALAR') { }
246 0 7 unless -e $filename
250 0 7 unless -r $filename
254 0 7 unless $infile->open("<$filename")
271 3 4 if ($type eq 'SCALAR' and $input =~ /<[^>]+>/ms) { }
291 2 0 if ($$params{'attributes'})
297 2 3 if ($vType) { }
299 2 0 if ($vType eq 'ARRAY')
336 0 49 unless $self->can($sub)
351 0 11 unless defined $name
377 0 3 unless defined $name
385 8 1 if ($valRef) { }
415 0 36 unless defined $name
419 0 36 unless defined $val
424 14 22 if ($$params{'attributes'}{$pname}{$name} or $$params{'attributes'}{'-all'}{$name}) { }
4 18 elsif ($name eq '-content') { }
449 2 0 if ($type and $type eq 'HASH')
484 0 1632 if ($XML::Mini::Debug)
490 70 1562 if ($useIgnore) { }
505 847 785 if ($#res == 5) { }
518 847 0 if ($prefix =~ /<\s*([^\s>]+)\s*([^>]*)>/) { }
523 220 627 if $attribs
525 847 0 if $contents =~ /\S/
527 585 262 if $remainder =~ /\S/
535 91 694 if ($XMLString =~ m[^\s*<\s*([^\s>]+)([^>]*>).*<\s*/\1\s*>]mos)
540 70 21 unless $startTag =~ m[/\s*>$]
546 715 0 if ($XMLString =~ m(^\s*(<\s*([^\s>]+)([^>]+)/\s*>| # <\?\s*([^\s>]+)\s*([^>]*)\?>| # | # \s*| # CDATA ]*)(\[.*?\])?\s*>\s*| # DOCTYPE ]+)\s*(["'])([^\11]+)\11\s*>\s*| # ENTITY ([^<]+))(.*))gimosx) { }
571 125 590 if ($unaryName) { }
11 579 elsif ($headerName) { }
2 577 elsif (defined $comment) { }
0 577 elsif (defined $cdata) { }
7 570 elsif ($doctype or defined $doctypeCont) { }
0 570 elsif (defined $entityName) { }
570 0 elsif (defined $plainText and $plainText =~ /\S/ms) { }
574 125 0 if $unaryAttribs
578 11 0 if $headerAttribs
588 0 7 if ($doctypeCont)
602 0 0 if $XML::Mini::Debug
606 119 596 if (defined $remainder and $remainder =~ /\S/ms)
613 0 0 if $XML::Mini::Debug
631 0 11 if ($XML::Mini::Debug)
649 11 0 if ($XML::Mini::Document::TextBalancedAvailable)
670 0 0 if ($12)
672 0 0 if ($doctypedef) { }
685 0 0 if (defined $uname) { }
0 0 elsif (defined $headername) { }
0 0 elsif (defined $comment) { }
0 0 elsif (defined $cdata) { }
0 0 elsif (defined $doctypedef) { }
0 0 elsif (defined $entityname) { }
0 0 elsif (defined $plaintext) { }
0 0 elsif ($1) { }
690 0 0 if (defined $ufinaltxt and $ufinaltxt =~ /\S+/)
697 0 0 if $headerAttribs
721 0 0 unless ($plaintext =~ /^\s+$/)
726 0 0 if (defined $afterTxt)
739 0 0 if ($nencl =~ /^\s*([^\s<][^<]*)/)
748 0 0 if (defined $finaltxt)
753 0 0 if (defined $otherTags)
771 0 0 if ($dir)
773 0 0 unless -e $dir and -d $dir
775 0 0 unless -w $dir
781 0 0 unless $contents
786 0 0 if ($safe)
788 0 0 if ($filename =~ m[/\.\./] or $filename =~ /#;`\*/)
793 0 0 if (-e $filename)
795 0 0 if ($safe =~ /NOOVERWRITE/i)
800 0 0 if (-l $filename)
808 0 0 unless $outfile->open(">$filename")
836 0 356 unless defined $attrString
843 381 0 if (defined $attrname)
845 8 373 unless defined $attrval and length $attrval