Branch Coverage

blib/lib/WWW/Scripter.pm
Criterion Covered Total %
branch 345 434 79.4


line true false branch
26 27 0 $LWP::UserAgent::VERSION >= 5.815 ? :
33 27 0 if (eval { do { require Hash::Util::FieldHash } }) { }
80 1 76 if exists $args{'max_docs'}
98 0 0 if @_
99 0 0 if @_
106 77 0 unless (exists $args{'agent'})
149 9 1 if ($self->is_html and $self->document)
152 2 7 if (exists $parms{'format'} and $parms{'format'} eq 'text')
154 2 0 defined $cs ? :
157 7 0 if defined $cs
171 0 16 if ($parms{'n'} eq 'all')
177 15 1 if ($link and $link->tag =~ /^a/) { }
199 2 13 unless $follow
208 0 1 if $self->{'autocheck'}
217 1 242 unless defined(my $request = shift())
224 0 0 unless $1
0 242 if ((my $path = $orig_uri->path) =~ s[^(/*)/\.\./]['/' unless $1;]e)
225 0 0 unless $1
229 8 234 if (defined $orig_uri->fragment)
235 6 2 if $meth eq 'GET' and $new_uri->eq($self->uri)
237 8 234 if ($new_uri)
243 6 236 if ($skip_fetch) { }
256 241 0 if ($meth eq 'GET' or $meth eq 'POST')
259 1 240 if $self->get_event_listeners('unload')
262 16 225 $self->{'Scripter_replace'} ? :
291 418 9 if ($res->is_success)
296 9 418 if ($res->is_error)
297 0 9 if ($self->{'autocheck'})
307 0 427 unless defined $content
311 395 32 if (!defined($self->{'Scripter_dumb'}) || $self->{'Scripter_dumb'} and $self->is_html) { }
338 16 0 if $base
349 45 350 if (my $doc = $document{$res})
376 53 297 if (%{$script_handlers{$self};})
383 1 0 unless lc $elem->attr('http-equiv') eq 'content-script-type'
386 51 2 unless defined $script_type
389 2 20 unless $scriptable{$self}
393 20 0 unless defined $lang
395 20 0 unless defined $lang
399 8 12 if ($uri = $elem->attr('src')) { }
401 0 8 unless ($res->is_success)
404 0 0 if (not defined $offset) { }
436 10 1 if (defined(my $offset = $elem->content_offset)) { }
445 0 19 unless CORE::length $code
448 18 1 if $h
450 1 18 if $@
454 0 0 unless $scriptable{$self}
461 2 15 unless $scriptable{$self}
464 15 0 unless defined $lang
467 15 0 defined $offset ? :
472 14 1 if (my $h = $self->_handler_for_lang($lang))
477 1 13 if $@
484 0 0 if $scriptable{$self} and %{$script_handlers{$self};}
489 8 342 if ($self->{'Scripter_i'})
491 3 8 unless defined(my $src = $_[1]->attr('src'))
494 3 5 if defined $self->{'Scripter_ih'}
497 1 2 unless $_[1]->type eq 'image'
501 0 7 unless (my $event = shift())->type eq 'DOMAttrModified'
502 0 7 unless (my $target = $event->target)->tag =~ /^i(mg|nput)\z/
503 2 5 if $1 eq 'nput' and $target->type ne 'image'
517 16 24 if (defined(my $name = $elem->attr('name')))
522 23 17 unless CORE::length(my $src = $elem->src)
532 348 2 unless $cs
543 138 212 defined $cs ? :
563 35 26 if (defined $lang)
566 5 29 if $lang_re eq 'default'
569 29 0 if $lang =~ /$lang_re/
579 0 25 unless defined $offset
601 17 1 if (my $doc = $self->document)
608 40 126 if exists $link_tags{$tag} and defined $_->attr($link_tags{$tag})
642 4 3 if (defined wantarray) { }
650 3 1 $go_for_it ? :
663 53 472 if ($base eq 'about:blank' and (my $parent = $self->parent) != $self)
666 472 0 CORE::length $base ? :
672 2 1 if (defined wantarray) { }
682 0 0 unless $_->type =~ /^(?:submit|image)\z/
683 0 0 if $button and $_->name ne $button
684 0 0 if $_->disabled
688 0 2 if $button and not $input
705 0 2 if $input
713 1 1 $go_for_it ? :
768 0 0 unless $self->{'Scripter_alert'}
788 0 373 if @_
841 16 9 defined $target ? :
843 14 11 if (defined $url and CORE::length $url) { }
5 6 elsif (not $target) { }
844 14 0 if (my $base = $self->base)
849 1 13 $replace ? :
868 5 1 if (my $g = $_[0]{'Scripter_g'}) { }
878 0 3 unless my $g = $_[0]{'Scripter_g'}
884 0 3 unless my $g = $_[0]{'Scripter_g'}
886 1 2 unless $next
887 1 1 unless $maybe_self == $_[0]
899 136 360 wantarray ? :
908 6 9 unless ($self->{'Scripter_t'})
912 6 5 unless $parent->{'Scripter_pa'}
921 185 61 unless $self->{'Scripter_pa'}
929 16 48 if @_
968 0 118 unless $_ = $t_o->[$id]
977 58 27 &reftype($_->[1]) eq 'CODE' || exists $INC{'overload.pm'} && defined &blessed($_->[1]) && overload::Method($_->[1], '&{}') ? :
71 14 $doing_timers_now ? :
85 33 if $_->[0] <= $time
998 62 10 if (my $t_o = $$_{$self->document})
1001 0 38 unless $t_o->[$id]
1006 2 34 unless &sum($count || (), map($_->count_timers, $self->frames))
1011 1 2 if $args{'max_wait'}
1027 36 11 if @_
1035 10 39 if (not CORE::length $name and my $doc = $self->document)
1036 1 9 if (my $base_elem = $doc->look_down('_tag', 'base', 'target', qr/(?:)/))
1040 9 40 unless CORE::length $name
1041 11 29 if ($name =~ /^_[Bb][Ll][Aa][Nn][Kk]\z/)
1042 4 7 if (my $g = $self->{'Scripter_g'})
1048 1 28 if $name =~ /^_[Ss][Ee][Ll][Ff]\z/
1049 2 26 if $name =~ /^_[Pp][Aa][Rr][Ee][Nn][Tt]\z/
1050 2 24 if $name =~ /^_[Tt][Oo][Pp]\z/
1057 1 29 if $current_ancestor->name eq $name
1058 5 24 $prev_ancestor ? :
1066 11 7 if ($_->name eq $name)
1072 12 6 if $prev_ancestor == $current_ancestor
1077 4 8 unless my $g = $self->{'Scripter_g'}
1083 4 4 $named->{$name} && ${$$named{$name};}->window_group ? :
1113 3 2 if @_
1119 4 2 if @_
1134 0 0 if $@
1142 0 15 if $self->{'cloning'}
1143 2 13 if (exists $plugins->{$plugin}) { }
1144 1 1 if @opts
1150 2 11 if @opts
1159 5 0 exists $self->{'plugins'}{$plugin} ? :
1164 17 3 if $name =~ /::/
1171 58 1 unless $self->{'plugins'}
1175 2 1 unless $po and defined &blessed($po) and $po->can('clone')
1182 8 0 unless defined $old
1183 8 0 if (@_)
1191 0 361 unless defined $old
1192 6 355 if (@_)
1204 22 0 if @_
1210 0 7 if @_
1211 7 0 if defined wantarray
1230 61 5 if (shift())
1243 3 3 if defined wantarray
1244 3 3 if @_
1250 9 2 if @_
1331 129 101 if (defined $self->[-1][0]) { }
1334 124 5 if $_[1]
1338 101 0 if $_[1]
1346 15 1 if (defined $self->[-1][0]) { }
1348 15 0 if $_[1]
1352 1 0 if $_[1]
1362 61 5 shift() ? :
1376 2 49 if (0 == $_[0]) { }
1381 4 45 if $new_pos < 0 or $new_pos > $#$self
1390 36 9 if (defined $entry->[1]) { }
1413 1 1 ($self->[$_][1] || 0) == $res ? :
1426 124 19 if ($check_max_hist)
1428 10 114 if ($max and @$self > $max)
1438 551 13 if defined $_->[1]
1440 143 0 if ($max) { }
1445 506 44 if exists $res{$refaddr} and not $seen{$refaddr}++
1447 130 13 unless @res > $max
1453 11 39 unless defined $_->[1]
1454 13 26 if exists $to_delete{0 + $_->[1]}
1464 163 490 unless $$self[$index{$self}][2]
1504 2 3 if defined $old
1505 1 4 if (@_)
1508 1 0 unless $uri_copy->eq($uri)
1510 3 2 unless $old
1516 1 1 if (@_)
1521 2 0 defined wantarray ? :
1527 1 1 if (@_)
1531 2 0 defined wantarray ? :
1536 10 3 if defined wantarray
1537 4 9 if (@_)
1548 1 1 if (@_)
1552 2 0 defined wantarray ? :
1558 1 1 if (@_)
1562 2 0 defined wantarray ? :
1568 1 1 if (@_)
1573 2 0 defined wantarray ? :
1579 2 1 if (@_)
1582 2 0 $1 || length $2 ? :
1588 1 2 unless defined wantarray
1590 0 2 defined $q ? :
1642 3 1 unless defined $old
1643 1 3 if @_
1650 2 1 unless defined $old
1651 1 2 if @_
1658 2 1 if (not defined $old and defined wantarray)
1660 2 0 $old =~ /(\d.*)/s ? :
1664 1 2 if @_
1675 10 0 if (not defined $old and defined wantarray)
1678 0 1 $ua =~ /\bIntel\b/ ? :
1 1 $^O ne 'darwin' ? :
1 2 $^O eq 'linux' ? :
1 3 $^O eq 'freebsd' ? :
1 4 $^O eq 'MacOS' ? :
1 5 $^O eq 'MSWin32' ? :
2 6 $ua =~ /\b(FreeBSD(?: i386)?|Linux)\b/ ? :
1 8 $ua =~ /\bMac(?:intosh)\b/ ? :
1 9 $ua =~ /\bWin(?:dows|32)?\b/ ? :
1691 0 10 if @_
1722 0 24 if (defined $proxy)
1730 0 24 if ($scheme ne 'about')
1735 2 22 unless $url eq 'about:blank'
1750 0 27 unless eval 'require WWW::Mechanize::Link'
1776 6 2 unless $url =~ s/^"(.+)"$/$1/
1779 8 0 $$self->attr('content') =~ /^\d+\s*;\s*url\s*=\s*(\S+)/i ? :
8 27 $$self->tag eq 'meta' ? :
13 15 $$self->tag eq 'a' ? :
20 0 $_ == 5 ? :
0 20 $_ == 4 ? :
36 20 $_ == 3 ? :
20 56 $_ == 2 ? :
28 76 $_ == 1 ? :
35 104 $_ == 0 ? :
1792 0 27 unless eval 'require WWW::Mechanize::Image'
1841 50 1 $doc ? :
1850 0 0 unless $w{shift()}