Branch Coverage

blib/lib/XML/API.pm
Criterion Covered Total %
branch 134 224 59.8


line true false branch
19 2 62 if ($self->{'comment'})
23 44 20 if exists $self->{'parent'}
45 0 26 unless (defined $val)
52 58 21 unless @strings
66 2 79 if ($self->{'comment'})
70 2 77 if ($self->{'cdata'})
74 8 69 unless (@{$self->{'contents'};})
79 0 8 $self->{'ns'} ? :
86 1 68 $self->{'ns'} ? :
90 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)
109 1 68 $self->{'ns'} ? :
116 0 2 if $self->{'comment'}
117 0 2 if $self->{'cdata'}
124 0 1 $self->{'ns'} ? :
1 1 unless @{$self->{'contents'};}
137 0 1 eval { do { $_->isa('XML::API') } } ? :
0 1 eval { do { $_->isa('XML::API::Element') } } ? :
144 0 1 $self->{'ns'} ? :
0 1 $self->{'ns'} ? :
167 0 0 if ($hash->{'Name'} eq '_xml_api_ignore')
185 0 0 if $self->{'xml_api_ignore'}
193 0 0 if ($hash->{'Name'} eq '_xml_api_ignore')
238 0 16 if ($class ne 'XML::API') { }
5 11 elsif ($self->{'doctype'}) { }
239 0 0 if ($self->{'doctype'})
245 1 4 unless (eval "require $class;1;")
288 4 54 if ($element eq $self->_root_element)
299 6 36 if ($next)
305 1 35 if (ref $arg eq 'HASH') { }
6 29 elsif (defined $arg and $arg =~ /^-[^0-9\.]+/o) { }
308 0 0 unless (defined $val)
317 0 6 unless (defined $attrs->{$arg})
333 4 54 if ($element eq $self->_root_element)
341 0 58 if $self->{'debug'}
343 4 54 if ($self->{'langnext'})
346 1 57 if ($self->{'dirnext'})
351 44 14 if ($self->{'current'}) { }
370 1 57 if ($self->{'_raw'}) { }
378 0 58 if $self->{'debug'}
386 0 107 unless ($self->{'current'})
391 0 78 unless defined $item
392 1 77 if (eval { do { $item->isa('XML::API') } }) { }
393 0 1 if (&refaddr($item) == &refaddr($self))
396 0 1 if (not $self->{'current'}) { }
411 44 33 if (eval { do { $item->isa('XML::API::Element') } }) { }
1 32 elsif (eval { do { $item->isa('XML::API::Cache') } }) { }
431 0 4 unless defined $item
432 0 4 if (ref $item and $item->isa('XML::API'))
435 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) { }
459 0 39 if $self->{'debug'}
493 23 37 if ($element =~ s/.*::(.+)_open$/$1/o) { }
11 26 elsif ($element =~ s/.*::(.+)_close$/$1/o) { }
1 25 elsif ($element =~ s/.*::(.+)_raw$/$1/o) { }
496 0 23 if ($element =~ s/(.+)__(.+)/$2/o)
517 0 25 unless $element
519 0 25 if ($element =~ /^_/o)
525 1 24 if ($element =~ s/(.+)__(.+)/$2/o)
540 0 1 unless (ref $val)
548 1 0 if (ref $val and ref $val eq 'ARRAY') { }
554 0 1 if ($arg =~ s/^-(.+)/$1/o) { }
0 1 elsif (ref $arg2 and ref $arg2 eq 'ARRAY') { }
565 0 1 if @val
573 0 1 if (ref $c and ref $c eq 'ARRAY') { }
1 0 elsif (ref $c and ref $c eq 'HASH') { }
610 0 0 if ($content =~ /\n/s) { }
634 0 2 unless defined $_ and $_ ne ''
661 0 0 unless defined $_ and $_ ne ''
688 2 3 if (@_)
690 0 2 if (not $attrs or ref $attrs ne 'HASH')
700 0 0 if (@_)
711 1 4 if ($self->{'has_root_element'} and not $self->_lang) { }
713 0 1 if ($dir)
719 1 3 if $dir
729 7 1 if ($self->{'current'})
731 5 2 if exists $self->{'current'}{'attrs'}{'xml:lang'}
736 1 2 if exists $e->{'attrs'}{'xml:lang'}
739 0 2 if $self->{'langnext'}
740 0 2 if $self->{'parent'}
752 4 1 if ($self->{'current'})
754 1 3 if exists $self->{'current'}{'attrs'}{'dir'}
759 0 0 if exists $e->{'attrs'}{'dir'}
762 0 4 if $self->{'dirnext'}
763 0 4 if $self->{'parent'}
769 0 0 if (@_)
777 0 0 if (@_)
792 0 0 if (not defined $id or $id eq '')
796 0 0 if (defined $self->{'ids'}{$id})
805 0 0 if (@_)
807 0 0 unless (defined $id)
811 0 0 if ($id->isa('XML::API::Element')) { }
0 0 elsif (defined $self->{'ids'}{$id}) { }
832 23 0 if (ref $self eq 'XML::API' or $self->{'has_root_element'})
834 5 18 if $self->_doctype
841 0 24 $_->isa('XML::API') ? :
846 0 23 if ($file)
847 0 0 unless open FH, '>' . $file
848 0 0 if ($self->_encoding eq 'UTF-8')
864 2 0 if (ref $self eq 'XML::API' or $self->{'has_root_element'})
866 0 2 if $self->_doctype
872 0 2 if ($file)
873 0 0 unless open FH, '>' . $file
874 0 0 if ($self->_encoding eq 'UTF-8')
886 0 41 unless defined $data
887 10 31 if ($data =~ /[\&\<\>\"(__AMP__)\']/o)