Branch Coverage

blib/lib/XML/API.pm
Criterion Covered Total %
branch 131 220 59.5


line true false branch
20 2 62 if ($self->{'comment'})
24 44 20 if exists $self->{'parent'}
50 0 26 unless (defined $val)
57 57 21 unless @strings
73 2 79 if ($self->{'comment'})
77 2 77 if ($self->{'cdata'})
81 8 69 unless (@{$self->{'contents'};})
83 0 8 $self->{'ns'} ? :
87 1 68 $self->{'ns'} ? :
91 48 52 if $c->isa('XML::API::Element')
48 56 if (eval { do { not $c->inline if $c->isa('XML::API::Element') } }) { }
3 53 elsif (eval { do { $c->isa('XML::API') } }) { }
101 53 0 if defined $c
105 28 41 if ($complex)
108 1 68 $self->{'ns'} ? :
116 0 1 if $self->{'comment'}
117 0 1 if $self->{'cdata'}
125 0 1 eval { do { $_->isa('XML::API') } } ? :
0 1 eval { do { $_->isa('XML::API::Element') } } ? :
129 0 1 $self->{'ns'} ? :
0 1 $self->{'ns'} ? :
154 0 0 if ($hash->{'Name'} eq '_xml_api_ignore')
173 0 0 if $self->{'xml_api_ignore'}
182 0 0 if ($hash->{'Name'} eq '_xml_api_ignore')
229 0 16 if ($class ne 'XML::API') { }
5 11 elsif ($self->{'doctype'}) { }
230 0 0 if ($self->{'doctype'})
236 1 4 unless (eval "require $class;1;")
284 4 54 if ($element eq $self->_root_element)
295 6 36 if ($next)
301 1 35 if (ref $arg eq 'HASH') { }
6 29 elsif (defined $arg and $arg =~ /^-[^0-9\.]+/o) { }
304 0 0 unless (defined $val)
313 0 6 unless (defined $attrs->{$arg})
329 4 54 if ($element eq $self->_root_element)
337 0 58 if $self->{'debug'}
339 4 54 if ($self->{'langnext'})
342 1 57 if ($self->{'dirnext'})
347 44 14 if ($self->{'current'}) { }
366 1 57 if ($self->{'_raw'}) { }
374 0 58 if $self->{'debug'}
384 0 107 unless ($self->{'current'})
389 0 78 unless defined $item
390 1 77 if (eval { do { $item->isa('XML::API') } }) { }
391 0 1 if (&refaddr($item) == &refaddr($self))
394 0 1 if (not $self->{'current'}) { }
409 44 33 if (eval { do { $item->isa('XML::API::Element') } }) { }
1 32 elsif (eval { do { $item->isa('XML::API::Cache') } }) { }
430 0 4 unless defined $item
431 0 4 if (ref $item and $item->isa('XML::API'))
434 3 1 if ($self->{'current'}) { }
448 0 46 if $self->{'debug'}
450 0 46 unless ($self->{'current'})
455 46 0 if ($element eq $self->{'current'}{'element'}) { }
456 39 7 if ($self->{'current'}->parent) { }
458 0 39 if $self->{'debug'}
491 23 37 if ($element =~ s/.*::(.+)_open$/$1/o) { }
11 26 elsif ($element =~ s/.*::(.+)_close$/$1/o) { }
1 25 elsif ($element =~ s/.*::(.+)_raw$/$1/o) { }
494 0 23 if ($element =~ s/(.+)__(.+)/$2/o)
515 0 25 unless $element
517 0 25 if ($element =~ /^_/o)
523 1 24 if ($element =~ s/(.+)__(.+)/$2/o)
539 0 1 unless (ref $val)
547 1 0 if (ref $val and ref $val eq 'ARRAY') { }
553 0 1 if ($arg =~ s/^-(.+)/$1/o) { }
0 1 elsif (ref $arg2 and ref $arg2 eq 'ARRAY') { }
564 0 1 if @val
572 0 1 if (ref $c and ref $c eq 'ARRAY') { }
1 0 elsif (ref $c and ref $c eq 'HASH') { }
611 0 0 if ($content =~ /\n/s) { }
637 0 2 unless defined $_ and $_ ne ''
662 0 0 unless defined $_ and $_ ne ''
687 2 3 if (@_)
689 0 2 if (not $attrs or ref $attrs ne 'HASH')
700 0 0 if (@_)
712 1 4 if ($self->{'has_root_element'} and not $self->_lang) { }
714 0 1 if ($dir)
720 1 3 if $dir
731 7 1 if ($self->{'current'})
733 5 2 if exists $self->{'current'}{'attrs'}{'xml:lang'}
738 1 2 if exists $e->{'attrs'}{'xml:lang'}
741 0 2 if $self->{'langnext'}
742 0 2 if $self->{'parent'}
756 4 1 if ($self->{'current'})
758 1 3 if exists $self->{'current'}{'attrs'}{'dir'}
763 0 0 if exists $e->{'attrs'}{'dir'}
766 0 4 if $self->{'dirnext'}
767 0 4 if $self->{'parent'}
774 0 0 if (@_)
783 0 0 if (@_)
799 0 0 if (not defined $id or $id eq '')
803 0 0 if (defined $self->{'ids'}{$id})
813 0 0 if (@_)
815 0 0 unless (defined $id)
819 0 0 if ($id->isa('XML::API::Element')) { }
0 0 elsif (defined $self->{'ids'}{$id}) { }
841 23 0 if (ref $self eq 'XML::API' or $self->{'has_root_element'})
843 5 18 if $self->_doctype
848 0 24 $_->isa('XML::API') ? :
852 0 23 if ($file)
853 0 0 unless open FH, '>' . $file
854 0 0 if ($self->_encoding eq 'UTF-8')
871 1 0 if (ref $self eq 'XML::API' or $self->{'has_root_element'})
873 0 1 if $self->_doctype
878 0 1 if ($file)
879 0 0 unless open FH, '>' . $file
880 0 0 if ($self->_encoding eq 'UTF-8')
893 0 41 unless defined $data
894 10 31 if ($data =~ /[\&\<\>\"(__AMP__)\']/o)