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")
101 42 0 unless exists $hash->{'debug'}
102 40 2 unless exists $hash->{'global_dom'}
103 42 0 unless exists $hash->{'debug_code'}
104 42 0 unless exists $hash->{'fatal_error'}
105 42 0 unless exists $hash->{'try_catch'}
106 0 42 if ($hash->{'fatal_error'})
111 0 42 if ($hash->{'try_catch'})
118 2 40 if ($hash->{'global_dom'})
136 0 2 unless ($self->{'global_dom'})
144 0 281 if $status < 0
146 0 281 if (/^__(?:DATA|END)__/)
157 0 2 if ($self->{'debug_file'})
159 0 0 if (open my $fh, ">$self->{'debug_file'}")
173 72 0 unless exists $self->{'_exception_class'}
174 0 72 unless $self->SUPER::init(@_)
226 1 18 unless $self->_is_a($parent, "HTML::Object::DOM::Document")
248 98 0 unless length $opts->{'raw'} or defined $opts->{'tag'}
252 0 0 exists $attr->{'/'} ? :
254 0 0 unless (length $opts->{'tag'})
285 0 0 unless ($def->{'is_empty'})
301 0 217 if ($opts->{'tag'} ne $me->tag) { }
303 0 0 if $self->_warnings_is_enabled
342 1 320 if ($opts->{'tag'} =~ s[/][])
348 0 321 unless (scalar keys %$def)
350 0 0 if exists $opts->{'attr'}{'/'}
355 0 321 unless exists $def->{'is_empty'}
388 278 43 if ($def->{'class'}) { }
398 221 100 unless ($def->{'is_empty'})
417 369 115 if ($opts->{'raw'} =~ /^[[:blank:]\h\v]*$/) { }
457 0 340 unless length $tag
460 0 340 unless exists $HTML::Object::DICT->{$tag}
516 0 292 unless $self->_load_class($class)
534 11 1 if (ref $this eq 'CODE' or ref $this eq 'GLOB' or "$this" =~ /<\w+/ or length "$this" > 1024) { }
0 1 elsif (ref $this) { }
553 0 44 if ($INC{'threads.pm'} and not exists $INC{'forks.pm'})
555 0 44 if ($opts->{'utf8'})
560 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)
563 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 ? :
566 0 44 if (length $self->{'current_parent'} and $self->_is_object($self->{'current_parent'})) { }
575 42 2 if ($self->isa("HTML::Object::DOM"))
577 2 40 if (my $code = $self->onload)
581 1 41 if (my $code = $self->onreadystatechange)
604 0 5 if (not $f->exists) { }
0 5 elsif ($f->is_empty) { }
613 0 5 if $opts->{'utf8'}
618 4 1 if ($self->isa("HTML::Object::DOM"))
620 0 4 if (my $code = $self->onload)
624 0 4 if (my $code = $self->onreadystatechange)
644 0 0 if (scalar @_ == 1 and ref $_[0] ne "HASH" or scalar @_ > 1 and @_ % 2 || scalar @_ == 2 && ref $_[1] eq 'HASH')
655 0 0 if defined $opts->{'uri'} and length $opts->{'uri'}
656 0 0 unless ($self->_load_class("LWP::UserAgent", {"version", "6.49"}))
660 0 0 unless ($self->_load_class("URI", {"version", "1.74"}))
665 0 0 if ($INC{'threads.pm'} and not exists $INC{'forks.pm'})
669 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)
672 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 ? :
675 0 0 if ($INC{'threads.pm'} and not exists $INC{'forks.pm'})
681 0 0 exists $opts->{'headers'} && defined $opts->{'headers'} && ref $opts->{'headers'} eq 'HASH' && scalar keys %{$$opts{'headers'};} ? :
682 0 0 if ($resp->header("Client-Warning") or not $resp->is_success)
692 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)
695 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 ? :
707 0 266 unless $self->_is_object($elem)
708 0 266 unless $elem->isa("HTML::Object::Element")
713 486 321 if $e->isa("HTML::Object::Closing") or $e->tag->substr(0, 1) eq "_"
714 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) { }
723 0 0 if (not $def->{'is_empty'}) { }
730 217 104 if not $e->is_empty
741 0 0 unless $self->_is_object($elem)
742 0 0 unless $elem->isa("HTML::Object::Element")
747 0 0 if $e->isa("HTML::Object::Closing") or $e->tag->substr(0, 1) eq "_"
748 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) { }
763 0 0 if (not $def->{'is_empty'}) { }
772 0 0 if not $e->is_empty
780 0 0 if (defined $html)
782 0 0 if (&Scalar::Util::blessed($html) and $html->isa('HTML::Object::Document')) { }
0 0 elsif (length $html) { }
799 9 138 unless $self->isa("HTML::Object::DOM")
801 0 138 unless defined $elem and $self->_is_a($elem, "HTML::Object::DOM::Document")
811 3 135 if (my $eh = $elem->onreadystatechange)
815 0 3 if ref $code ne "CODE"
816 3 0 if ref $code eq "CODE"
818 2 136 if ($state eq "complete" and my $code = $elem->onload)