Branch Coverage

blib/lib/WWW/Scripter.pm
Criterion Covered Total %
branch 347 438 79.2


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 6 1 if ($self->is_html and $self->document)
152 2 4 if (exists $parms{'format'} and $parms{'format'} eq 'text')
154 2 0 defined $cs ? :
157 4 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 238 unless defined(my $request = shift())
224 0 0 unless $1
0 238 if ((my $path = $orig_uri->path) =~ s[^(/*)/\.\./]['/' unless $1;]e)
225 0 0 unless $1
229 9 229 if (defined $orig_uri->fragment)
235 7 2 if $meth eq 'GET' and $new_uri->eq($self->uri)
237 9 229 if ($new_uri)
243 7 231 if ($skip_fetch) { }
256 237 0 if ($meth eq 'GET' or $meth eq 'POST')
259 1 236 if $self->get_event_listeners('unload')
262 14 223 $self->{'Scripter_replace'} ? :
275 0 220 if ref $uri eq 'WWW::Mechanize::Link'
278 1 0 if ($abs =~ /^data:#/i and $abs ne $uri and $uri =~ /^#/)
303 414 9 if ($res->is_success)
308 9 414 if ($res->is_error)
309 0 9 if ($self->{'autocheck'})
319 0 423 unless defined $content
323 391 32 if (!defined($self->{'Scripter_dumb'}) || $self->{'Scripter_dumb'} and $self->is_html) { }
350 16 0 if $base
361 45 346 if (my $doc = $document{$res})
388 48 298 if (%{$script_handlers{$self};})
395 1 0 unless lc $elem->attr('http-equiv') eq 'content-script-type'
398 46 2 unless defined $script_type
401 2 18 unless $scriptable{$self}
405 18 0 unless defined $lang
407 18 0 unless defined $lang
411 8 10 if ($uri = $elem->attr('src')) { }
413 0 8 unless ($res->is_success)
416 0 0 if (not defined $offset) { }
450 8 1 if (defined(my $offset = $elem->content_offset)) { }
459 0 17 unless CORE::length $code
462 16 1 if $h
464 1 16 if $@
468 0 0 unless $scriptable{$self}
475 2 15 unless $scriptable{$self}
478 15 0 unless defined $lang
481 15 0 defined $offset ? :
486 14 1 if (my $h = $self->_handler_for_lang($lang))
491 1 13 if $@
498 0 0 if $scriptable{$self} and %{$script_handlers{$self};}
503 8 338 if ($self->{'Scripter_i'})
505 3 8 unless defined(my $src = $_[1]->attr('src'))
508 3 5 if defined $self->{'Scripter_ih'}
511 1 2 unless $_[1]->type eq 'image'
515 0 7 unless (my $event = shift())->type eq 'DOMAttrModified'
516 0 7 unless (my $target = $event->target)->tag =~ /^i(mg|nput)\z/
517 2 5 if $1 eq 'nput' and $target->type ne 'image'
531 16 24 if (defined(my $name = $elem->attr('name')))
536 23 17 unless CORE::length(my $src = $elem->src)
546 344 2 unless $cs
557 133 213 defined $cs ? :
577 35 24 if (defined $lang)
580 5 29 if $lang_re eq 'default'
583 29 0 if $lang =~ /$lang_re/
593 0 23 unless defined $offset
615 17 1 if (my $doc = $self->document)
622 40 126 if exists $link_tags{$tag} and defined $_->attr($link_tags{$tag})
656 4 3 if (defined wantarray) { }
664 3 1 $go_for_it ? :
677 29 258 if ($base eq 'about:blank' and (my $parent = $self->parent) != $self)
680 258 0 CORE::length $base ? :
686 2 1 if (defined wantarray) { }
696 0 0 unless $_->type =~ /^(?:submit|image)\z/
697 0 0 if $button and $_->name ne $button
698 0 0 if $_->disabled
702 0 2 if $button and not $input
719 0 2 if $input
727 1 1 $go_for_it ? :
782 0 0 unless $self->{'Scripter_alert'}
802 0 370 if @_
855 16 9 defined $target ? :
857 14 11 if (defined $url and CORE::length $url) { }
5 6 elsif (not $target) { }
858 14 0 if (my $base = $self->base)
863 1 13 $replace ? :
882 5 1 if (my $g = $_[0]{'Scripter_g'}) { }
892 0 3 unless my $g = $_[0]{'Scripter_g'}
898 0 3 unless my $g = $_[0]{'Scripter_g'}
900 1 2 unless $next
901 1 1 unless $maybe_self == $_[0]
913 136 52 wantarray ? :
922 6 9 unless ($self->{'Scripter_t'})
926 6 5 unless $parent->{'Scripter_pa'}
935 101 37 unless $self->{'Scripter_pa'}
943 16 48 if @_
982 0 118 unless $_ = $t_o->[$id]
991 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
1012 62 10 if (my $t_o = $$_{$self->document})
1015 0 38 unless $t_o->[$id]
1020 2 34 unless &sum($count || (), map($_->count_timers, $self->frames))
1025 1 2 if $args{'max_wait'}
1041 36 11 if @_
1049 10 39 if (not CORE::length $name and my $doc = $self->document)
1050 1 9 if (my $base_elem = $doc->look_down('_tag', 'base', 'target', qr/(?:)/))
1054 9 40 unless CORE::length $name
1055 11 29 if ($name =~ /^_[Bb][Ll][Aa][Nn][Kk]\z/)
1056 4 7 if (my $g = $self->{'Scripter_g'})
1062 1 28 if $name =~ /^_[Ss][Ee][Ll][Ff]\z/
1063 2 26 if $name =~ /^_[Pp][Aa][Rr][Ee][Nn][Tt]\z/
1064 2 24 if $name =~ /^_[Tt][Oo][Pp]\z/
1071 1 29 if $current_ancestor->name eq $name
1072 5 24 $prev_ancestor ? :
1080 11 7 if ($_->name eq $name)
1086 12 6 if $prev_ancestor == $current_ancestor
1091 4 8 unless my $g = $self->{'Scripter_g'}
1097 4 4 $named->{$name} && ${$$named{$name};}->window_group ? :
1127 3 2 if @_
1133 4 2 if @_
1148 0 0 if $@
1156 0 14 if $self->{'cloning'}
1157 2 12 if (exists $plugins->{$plugin}) { }
1158 1 1 if @opts
1164 2 10 if @opts
1173 5 0 exists $self->{'plugins'}{$plugin} ? :
1178 17 2 if $name =~ /::/
1185 58 1 unless $self->{'plugins'}
1189 2 1 unless $po and defined &blessed($po) and $po->can('clone')
1196 8 0 unless defined $old
1197 8 0 if (@_)
1205 0 357 unless defined $old
1206 6 351 if (@_)
1218 20 0 if @_
1224 0 5 if @_
1225 5 0 if defined wantarray
1244 61 5 if (shift())
1257 3 3 if defined wantarray
1258 3 3 if @_
1264 9 2 if @_
1345 128 100 if (defined $self->[-1][0]) { }
1348 123 5 if $_[1]
1352 100 0 if $_[1]
1360 13 1 if (defined $self->[-1][0]) { }
1362 13 0 if $_[1]
1366 1 0 if $_[1]
1376 61 5 shift() ? :
1390 2 49 if (0 == $_[0]) { }
1395 4 45 if $new_pos < 0 or $new_pos > $#$self
1404 36 9 if (defined $entry->[1]) { }
1427 1 1 ($self->[$_][1] || 0) == $res ? :
1440 123 17 if ($check_max_hist)
1442 10 113 if ($max and @$self > $max)
1452 552 13 if defined $_->[1]
1454 140 0 if ($max) { }
1459 501 42 if exists $res{$refaddr} and not $seen{$refaddr}++
1461 127 13 unless @res > $max
1467 11 39 unless defined $_->[1]
1468 13 26 if exists $to_delete{0 + $_->[1]}
1478 163 483 unless $$self[$index{$self}][2]
1518 2 3 if defined $old
1519 1 4 if (@_)
1522 1 0 unless $uri_copy->eq($uri)
1524 3 2 unless $old
1530 1 1 if (@_)
1535 2 0 defined wantarray ? :
1541 1 1 if (@_)
1545 2 0 defined wantarray ? :
1550 10 3 if defined wantarray
1551 4 9 if (@_)
1562 1 1 if (@_)
1566 2 0 defined wantarray ? :
1572 1 1 if (@_)
1576 2 0 defined wantarray ? :
1582 1 1 if (@_)
1587 2 0 defined wantarray ? :
1593 2 1 if (@_)
1596 2 0 $1 || length $2 ? :
1602 1 2 unless defined wantarray
1604 0 2 defined $q ? :
1656 3 1 unless defined $old
1657 1 3 if @_
1664 2 1 unless defined $old
1665 1 2 if @_
1672 2 1 if (not defined $old and defined wantarray)
1674 2 0 $old =~ /(\d.*)/s ? :
1678 1 2 if @_
1689 10 0 if (not defined $old and defined wantarray)
1692 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/ ? :
1705 0 10 if @_
1736 0 24 if (defined $proxy)
1744 0 24 if ($scheme ne 'about')
1749 2 22 unless $url eq 'about:blank'
1764 0 27 unless eval 'require WWW::Mechanize::Link'
1790 6 2 unless $url =~ s/^"(.+)"$/$1/
1793 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 ? :
1806 0 27 unless eval 'require WWW::Mechanize::Image'
1855 48 1 $doc ? :
1864 0 0 unless $w{shift()}