Branch Coverage

lib/HTML/Object.pm
Criterion Covered Total %
branch 84 546 15.3


line true false branch
87 2 4 if ($_[$i] eq "debug" or $_[$i] eq "debug_code" or $_[$i] eq "debug_file" or $_[$i] eq "fatal_error" or $_[$i] eq "global_dom" or $_[$i] eq "try_catch")
104 42 0 unless exists $hash->{'debug'}
105 40 2 unless exists $hash->{'global_dom'}
106 42 0 unless exists $hash->{'debug_code'}
107 42 0 unless exists $hash->{'fatal_error'}
108 42 0 unless exists $hash->{'try_catch'}
109 0 42 if ($hash->{'fatal_error'})
114 0 42 if ($hash->{'try_catch'})
121 2 40 if ($hash->{'global_dom'})
139 0 2 unless ($self->{'global_dom'})
147 0 281 if $status < 0
149 0 281 if (/^__(?:DATA|END)__/)
160 0 2 if ($self->{'debug_file'})
162 0 0 if (open my $fh, ">$self->{'debug_file'}")
176 72 0 unless exists $self->{'_exception_class'}
177 0 72 unless $self->SUPER::init(@_)
229 1 18 unless $self->_is_a($parent, "HTML::Object::DOM::Document")
251 98 0 unless length $opts->{'raw'} or defined $opts->{'tag'}
255 0 0 exists $attr->{'/'} ? :
257 0 0 unless (length $opts->{'tag'})
288 0 0 unless ($def->{'is_empty'})
304 0 217 if ($opts->{'tag'} ne $me->tag) { }
306 0 0 if $self->_warnings_is_enabled
345 1 320 if ($opts->{'tag'} =~ s[/][])
351 0 321 unless (scalar keys %$def)
353 0 0 if exists $opts->{'attr'}{'/'}
358 0 321 unless exists $def->{'is_empty'}
391 278 43 if ($def->{'class'}) { }
401 221 100 unless ($def->{'is_empty'})
420 369 115 if ($opts->{'raw'} =~ /^[[:blank:]\h\v]*$/) { }
460 0 340 unless length $tag
463 0 340 unless exists $HTML::Object::DICT->{$tag}
519 0 292 unless $self->_load_class($class)
537 11 1 if (ref $this eq 'CODE' or ref $this eq 'GLOB' or "$this" =~ /<\w+/ or length "$this" > 1024) { }
0 1 elsif (ref $this) { }
556 0 44 if ($INC{'threads.pm'} and not exists $INC{'forks.pm'})
558 0 44 if ($opts->{'utf8'})
563 0 0 if not defined $Nice::Try::WANTARRAY and scalar @Nice::Try::LAST_VAL
0 0 &$Nice::Try::TRY ? :
0 0 if scalar @Nice::Try::VOID
0 0 if ($Nice::Try::WANT eq 'OBJECT') { }
0 0 elsif ($Nice::Try::WANT eq 'CODE') { }
0 0 elsif ($Nice::Try::WANT eq 'HASH') { }
0 0 elsif ($Nice::Try::WANT eq 'ARRAY') { }
0 0 elsif ($Nice::Try::WANT eq 'REFSCALAR') { }
0 0 elsif ($Nice::Try::WANT eq 'GLOB') { }
0 0 elsif ($Nice::Try::WANT eq 'LIST') { }
0 0 elsif ($Nice::Try::WANT eq 'BOOLEAN') { }
0 0 elsif ($Nice::Try::WANT eq 'VOID') { }
0 0 elsif ($Nice::Try::WANT eq 'SCALAR') { }
0 0 if defined $Nice::Try::LAST_VAL
0 44 if ($Nice::Try::WANTARRAY) { }
44 0 elsif (defined $Nice::Try::WANTARRAY) { }
0 44 if (defined $Nice::Try::WANT and length $Nice::Try::WANT) { }
0 44 length $@ ? :
44 0 unless &Scalar::Util::blessed($@)
0 0 if ($Nice::Try::HAS_CATCH)
0 44 if ($Nice::Try::DIED)
566 0 0 if not defined $Nice::Try::WANTARRAY and scalar @Nice::Try::LAST_VAL
0 0 &$Nice::Try::CATCH ? :
0 0 if scalar @Nice::Try::VOID
0 0 if ($Nice::Try::WANT eq 'OBJECT') { }
0 0 elsif ($Nice::Try::WANT eq 'CODE') { }
0 0 elsif ($Nice::Try::WANT eq 'HASH') { }
0 0 elsif ($Nice::Try::WANT eq 'ARRAY') { }
0 0 elsif ($Nice::Try::WANT eq 'REFSCALAR') { }
0 0 elsif ($Nice::Try::WANT eq 'GLOB') { }
0 0 elsif ($Nice::Try::WANT eq 'LIST') { }
0 0 elsif ($Nice::Try::WANT eq 'BOOLEAN') { }
0 0 elsif ($Nice::Try::WANT eq 'VOID') { }
0 0 elsif ($Nice::Try::WANT eq 'SCALAR') { }
0 0 if ($Nice::Try::WANTARRAY) { }
0 0 elsif (defined $Nice::Try::WANTARRAY) { }
0 0 if (defined $Nice::Try::WANT and length $Nice::Try::WANT) { }
0 0 if $@
0 44 if (defined $Nice::Try::CATCH_DIED)
0 0 if (defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq '__NEXT__') { }
0 0 elsif (defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq '__LAST__') { }
0 0 elsif (defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq '__REDO__') { }
0 0 elsif (defined $Nice::Try::BREAK and $Nice::Try::BREAK eq 'return') { }
0 0 if ($Nice::Try::WANT eq 'LIST') { }
0 0 elsif ($Nice::Try::WANT eq 'VOID') { }
0 0 elsif ($Nice::Try::WANT eq 'OBJECT') { }
0 0 elsif ($Nice::Try::WANT eq 'REFSCALAR') { }
0 0 elsif ($Nice::Try::WANT eq 'SCALAR') { }
0 0 elsif ($Nice::Try::WANT eq 'BOOLEAN') { }
0 0 elsif ($Nice::Try::WANT eq 'CODE') { }
0 0 elsif ($Nice::Try::WANT eq 'HASH') { }
0 0 elsif ($Nice::Try::WANT eq 'ARRAY') { }
0 0 elsif ($Nice::Try::WANT eq 'GLOB') { }
0 0 $Nice::Try::WANTARRAY ? :
0 0 if (defined $Nice::Try::WANT and length $Nice::Try::WANT) { }
0 0 if (not defined $Nice::Try::BREAK or $Nice::Try::BREAK eq "return")
0 0 scalar @Nice::Try::VOID > 1 ? :
0 44 if (defined $Nice::Try::WANTARRAY || defined $Nice::Try::BREAK && $Nice::Try::BREAK eq 'return' and !&Scalar::Util::blessed($Nice::Try::RETVAL[0]) || &Scalar::Util::blessed($Nice::Try::RETVAL[0]) && !$Nice::Try::RETVAL[0]->isa('Nice::Try::SENTINEL')) { }
0 44 elsif (scalar @Nice::Try::VOID and !&Scalar::Util::blessed($Nice::Try::VOID[0]) || &Scalar::Util::blessed($Nice::Try::VOID[0]) && !$Nice::Try::VOID[0]->isa('Nice::Try::SENTINEL')) { }
0 0 if ($Nice::Try::BREAK eq 'next') { }
0 0 elsif ($Nice::Try::BREAK eq 'last') { }
0 0 elsif ($Nice::Try::BREAK eq 'redo') { }
0 44 if (defined $Nice::Try::BREAK)
0 44 scalar @Nice::Try::LAST_VAL > 1 ? :
569 0 44 if (length $self->{'current_parent'} and $self->_is_object($self->{'current_parent'})) { }
578 42 2 if ($self->isa("HTML::Object::DOM"))
580 2 40 if (my $code = $self->onload)
584 1 41 if (my $code = $self->onreadystatechange)
607 0 5 if (not $f->exists) { }
0 5 elsif ($f->is_empty) { }
616 0 5 if $opts->{'utf8'}
621 4 1 if ($self->isa("HTML::Object::DOM"))
623 0 4 if (my $code = $self->onload)
627 0 4 if (my $code = $self->onreadystatechange)
647 0 0 if (scalar @_ == 1 and ref $_[0] ne "HASH" or scalar @_ > 1 and @_ % 2 || scalar @_ == 2 && ref $_[1] eq 'HASH')
658 0 0 if defined $opts->{'uri'} and length $opts->{'uri'}
659 0 0 unless ($self->_load_class("LWP::UserAgent", {"version", "6.49"}))
663 0 0 unless ($self->_load_class("URI", {"version", "1.74"}))
668 0 0 if ($INC{'threads.pm'} and not exists $INC{'forks.pm'})
672 0 0 if not defined $Nice::Try::WANTARRAY and scalar @Nice::Try::LAST_VAL
0 0 &$Nice::Try::TRY ? :
0 0 if scalar @Nice::Try::VOID
0 0 if ($Nice::Try::WANT eq 'OBJECT') { }
0 0 elsif ($Nice::Try::WANT eq 'CODE') { }
0 0 elsif ($Nice::Try::WANT eq 'HASH') { }
0 0 elsif ($Nice::Try::WANT eq 'ARRAY') { }
0 0 elsif ($Nice::Try::WANT eq 'REFSCALAR') { }
0 0 elsif ($Nice::Try::WANT eq 'GLOB') { }
0 0 elsif ($Nice::Try::WANT eq 'LIST') { }
0 0 elsif ($Nice::Try::WANT eq 'BOOLEAN') { }
0 0 elsif ($Nice::Try::WANT eq 'VOID') { }
0 0 elsif ($Nice::Try::WANT eq 'SCALAR') { }
0 0 if defined $Nice::Try::LAST_VAL
0 0 if ($Nice::Try::WANTARRAY) { }
0 0 elsif (defined $Nice::Try::WANTARRAY) { }
0 0 if (defined $Nice::Try::WANT and length $Nice::Try::WANT) { }
0 0 length $@ ? :
0 0 unless &Scalar::Util::blessed($@)
0 0 if ($Nice::Try::HAS_CATCH)
0 0 if ($Nice::Try::DIED)
675 0 0 if not defined $Nice::Try::WANTARRAY and scalar @Nice::Try::LAST_VAL
0 0 &$Nice::Try::CATCH ? :
0 0 if scalar @Nice::Try::VOID
0 0 if ($Nice::Try::WANT eq 'OBJECT') { }
0 0 elsif ($Nice::Try::WANT eq 'CODE') { }
0 0 elsif ($Nice::Try::WANT eq 'HASH') { }
0 0 elsif ($Nice::Try::WANT eq 'ARRAY') { }
0 0 elsif ($Nice::Try::WANT eq 'REFSCALAR') { }
0 0 elsif ($Nice::Try::WANT eq 'GLOB') { }
0 0 elsif ($Nice::Try::WANT eq 'LIST') { }
0 0 elsif ($Nice::Try::WANT eq 'BOOLEAN') { }
0 0 elsif ($Nice::Try::WANT eq 'VOID') { }
0 0 elsif ($Nice::Try::WANT eq 'SCALAR') { }
0 0 if ($Nice::Try::WANTARRAY) { }
0 0 elsif (defined $Nice::Try::WANTARRAY) { }
0 0 if (defined $Nice::Try::WANT and length $Nice::Try::WANT) { }
0 0 if $@
0 0 if (defined $Nice::Try::CATCH_DIED)
0 0 if (defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq '__NEXT__') { }
0 0 elsif (defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq '__LAST__') { }
0 0 elsif (defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq '__REDO__') { }
0 0 elsif (defined $Nice::Try::BREAK and $Nice::Try::BREAK eq 'return') { }
0 0 if ($Nice::Try::WANT eq 'LIST') { }
0 0 elsif ($Nice::Try::WANT eq 'VOID') { }
0 0 elsif ($Nice::Try::WANT eq 'OBJECT') { }
0 0 elsif ($Nice::Try::WANT eq 'REFSCALAR') { }
0 0 elsif ($Nice::Try::WANT eq 'SCALAR') { }
0 0 elsif ($Nice::Try::WANT eq 'BOOLEAN') { }
0 0 elsif ($Nice::Try::WANT eq 'CODE') { }
0 0 elsif ($Nice::Try::WANT eq 'HASH') { }
0 0 elsif ($Nice::Try::WANT eq 'ARRAY') { }
0 0 elsif ($Nice::Try::WANT eq 'GLOB') { }
0 0 $Nice::Try::WANTARRAY ? :
0 0 if (defined $Nice::Try::WANT and length $Nice::Try::WANT) { }
0 0 if (not defined $Nice::Try::BREAK or $Nice::Try::BREAK eq "return")
0 0 scalar @Nice::Try::VOID > 1 ? :
0 0 if (defined $Nice::Try::WANTARRAY || defined $Nice::Try::BREAK && $Nice::Try::BREAK eq 'return' and !&Scalar::Util::blessed($Nice::Try::RETVAL[0]) || &Scalar::Util::blessed($Nice::Try::RETVAL[0]) && !$Nice::Try::RETVAL[0]->isa('Nice::Try::SENTINEL')) { }
0 0 elsif (scalar @Nice::Try::VOID and !&Scalar::Util::blessed($Nice::Try::VOID[0]) || &Scalar::Util::blessed($Nice::Try::VOID[0]) && !$Nice::Try::VOID[0]->isa('Nice::Try::SENTINEL')) { }
0 0 if ($Nice::Try::BREAK eq 'next') { }
0 0 elsif ($Nice::Try::BREAK eq 'last') { }
0 0 elsif ($Nice::Try::BREAK eq 'redo') { }
0 0 if (defined $Nice::Try::BREAK)
0 0 scalar @Nice::Try::LAST_VAL > 1 ? :
678 0 0 if ($INC{'threads.pm'} and not exists $INC{'forks.pm'})
684 0 0 exists $opts->{'headers'} && defined $opts->{'headers'} && ref $opts->{'headers'} eq 'HASH' && scalar keys %{$$opts{'headers'};} ? :
685 0 0 if ($resp->header("Client-Warning") or not $resp->is_success)
695 0 0 if not defined $Nice::Try::WANTARRAY and scalar @Nice::Try::LAST_VAL
0 0 &$Nice::Try::TRY ? :
0 0 if scalar @Nice::Try::VOID
0 0 if ($Nice::Try::WANT eq 'OBJECT') { }
0 0 elsif ($Nice::Try::WANT eq 'CODE') { }
0 0 elsif ($Nice::Try::WANT eq 'HASH') { }
0 0 elsif ($Nice::Try::WANT eq 'ARRAY') { }
0 0 elsif ($Nice::Try::WANT eq 'REFSCALAR') { }
0 0 elsif ($Nice::Try::WANT eq 'GLOB') { }
0 0 elsif ($Nice::Try::WANT eq 'LIST') { }
0 0 elsif ($Nice::Try::WANT eq 'BOOLEAN') { }
0 0 elsif ($Nice::Try::WANT eq 'VOID') { }
0 0 elsif ($Nice::Try::WANT eq 'SCALAR') { }
0 0 if defined $Nice::Try::LAST_VAL
0 0 if ($Nice::Try::WANTARRAY) { }
0 0 elsif (defined $Nice::Try::WANTARRAY) { }
0 0 if (defined $Nice::Try::WANT and length $Nice::Try::WANT) { }
0 0 length $@ ? :
0 0 unless &Scalar::Util::blessed($@)
0 0 if ($Nice::Try::HAS_CATCH)
0 0 if ($Nice::Try::DIED)
698 0 0 if not defined $Nice::Try::WANTARRAY and scalar @Nice::Try::LAST_VAL
0 0 &$Nice::Try::CATCH ? :
0 0 if scalar @Nice::Try::VOID
0 0 if ($Nice::Try::WANT eq 'OBJECT') { }
0 0 elsif ($Nice::Try::WANT eq 'CODE') { }
0 0 elsif ($Nice::Try::WANT eq 'HASH') { }
0 0 elsif ($Nice::Try::WANT eq 'ARRAY') { }
0 0 elsif ($Nice::Try::WANT eq 'REFSCALAR') { }
0 0 elsif ($Nice::Try::WANT eq 'GLOB') { }
0 0 elsif ($Nice::Try::WANT eq 'LIST') { }
0 0 elsif ($Nice::Try::WANT eq 'BOOLEAN') { }
0 0 elsif ($Nice::Try::WANT eq 'VOID') { }
0 0 elsif ($Nice::Try::WANT eq 'SCALAR') { }
0 0 if ($Nice::Try::WANTARRAY) { }
0 0 elsif (defined $Nice::Try::WANTARRAY) { }
0 0 if (defined $Nice::Try::WANT and length $Nice::Try::WANT) { }
0 0 if $@
0 0 if (defined $Nice::Try::CATCH_DIED)
0 0 if (defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq '__NEXT__') { }
0 0 elsif (defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq '__LAST__') { }
0 0 elsif (defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq '__REDO__') { }
0 0 elsif (defined $Nice::Try::BREAK and $Nice::Try::BREAK eq 'return') { }
0 0 if ($Nice::Try::WANT eq 'LIST') { }
0 0 elsif ($Nice::Try::WANT eq 'VOID') { }
0 0 elsif ($Nice::Try::WANT eq 'OBJECT') { }
0 0 elsif ($Nice::Try::WANT eq 'REFSCALAR') { }
0 0 elsif ($Nice::Try::WANT eq 'SCALAR') { }
0 0 elsif ($Nice::Try::WANT eq 'BOOLEAN') { }
0 0 elsif ($Nice::Try::WANT eq 'CODE') { }
0 0 elsif ($Nice::Try::WANT eq 'HASH') { }
0 0 elsif ($Nice::Try::WANT eq 'ARRAY') { }
0 0 elsif ($Nice::Try::WANT eq 'GLOB') { }
0 0 $Nice::Try::WANTARRAY ? :
0 0 if (defined $Nice::Try::WANT and length $Nice::Try::WANT) { }
0 0 if (not defined $Nice::Try::BREAK or $Nice::Try::BREAK eq "return")
0 0 scalar @Nice::Try::VOID > 1 ? :
0 0 if (defined $Nice::Try::WANTARRAY || defined $Nice::Try::BREAK && $Nice::Try::BREAK eq 'return' and !&Scalar::Util::blessed($Nice::Try::RETVAL[0]) || &Scalar::Util::blessed($Nice::Try::RETVAL[0]) && !$Nice::Try::RETVAL[0]->isa('Nice::Try::SENTINEL')) { }
0 0 elsif (scalar @Nice::Try::VOID and !&Scalar::Util::blessed($Nice::Try::VOID[0]) || &Scalar::Util::blessed($Nice::Try::VOID[0]) && !$Nice::Try::VOID[0]->isa('Nice::Try::SENTINEL')) { }
0 0 if ($Nice::Try::BREAK eq 'next') { }
0 0 elsif ($Nice::Try::BREAK eq 'last') { }
0 0 elsif ($Nice::Try::BREAK eq 'redo') { }
0 0 if (defined $Nice::Try::BREAK)
0 0 scalar @Nice::Try::LAST_VAL > 1 ? :
710 0 266 unless $self->_is_object($elem)
711 0 266 unless $elem->isa("HTML::Object::Element")
716 486 321 if $e->isa("HTML::Object::Closing") or $e->tag->substr(0, 1) eq "_"
717 0 321 if ($e->is_empty and $e->children->length) { }
5 316 elsif ($e->is_empty and not $e->attributes->exists('/')) { }
0 316 elsif (not $e->is_empty || $e->is_closed) { }
726 0 0 if (not $def->{'is_empty'}) { }
733 217 104 if not $e->is_empty
744 0 0 unless $self->_is_object($elem)
745 0 0 unless $elem->isa("HTML::Object::Element")
750 0 0 if $e->isa("HTML::Object::Closing") or $e->tag->substr(0, 1) eq "_"
751 0 0 if ($e->is_empty and $e->children->length) { }
0 0 elsif ($e->is_empty and not $e->attributes->exists('/')) { }
0 0 elsif (not $e->is_empty and $e->attributes->exists('/')) { }
0 0 elsif (not $e->is_empty || $e->is_closed) { }
766 0 0 if (not $def->{'is_empty'}) { }
775 0 0 if not $e->is_empty
783 0 0 if (defined $html)
785 0 0 if (&Scalar::Util::blessed($html) and $html->isa('HTML::Object::Document')) { }
0 0 elsif (length $html) { }
802 9 138 unless $self->isa("HTML::Object::DOM")
804 0 138 unless defined $elem and $self->_is_a($elem, "HTML::Object::DOM::Document")
814 3 135 if (my $eh = $elem->onreadystatechange)
818 0 3 if ref $code ne "CODE"
819 3 0 if ref $code eq "CODE"
821 2 136 if ($state eq "complete" and my $code = $elem->onload)