Condition Coverage

blib/lib/WWW/Mechanize.pm
Criterion Covered Total %
condition 229 266 86.0


and 3 conditions

line !l l&&!r l&&r condition
226 1 2 26 $stack and @{$stack;}
252 1 0 14 $self->{'req'} and $self->{'res'}
266 1 0 9 $self->{'req'} and $self->{'res'}
273 0 1 0 $stack and @$stack >= $n
282 1 3 56 $self->res && $self->res->is_success
300 5 353 0 defined $self->ct && ($self->ct eq 'text/html' || $self->ct eq 'application/xhtml+xml')
470 475 3 93 defined $p->{'url'} and not $link->url eq $p->{'url'}
471 405 10 63 defined $p->{'url_regex'} and not $link->url =~ /$p->{'url_regex'}/
472 389 0 26 defined $p->{'url_abs'} and not $link->url_abs eq $p->{'url_abs'}
475 364 1 24 defined $p->{'url_abs_regex'} and not $link->url_abs =~ /$p->{'url_abs_regex'}/
478 28 39 8 defined $link->text && $link->text eq $p->{'text'}
290 8 67 defined $p->{'text'} and not defined $link->text && $link->text eq $p->{'text'}
481 54 91 20 defined $link->text && $link->text =~ /$p->{'text_regex'}/
133 20 145 defined $p->{'text_regex'} and not defined $link->text && $link->text =~ /$p->{'text_regex'}/
484 9 0 1 defined $link->name && $link->name eq $p->{'name'}
143 1 9 defined $p->{'name'} and not defined $link->name && $link->name eq $p->{'name'}
487 13 2 2 defined $link->name && $link->name =~ /$p->{'name_regex'}/
127 2 15 defined $p->{'name_regex'} and not defined $link->name && $link->name =~ /$p->{'name_regex'}/
488 0 4 8 $link->tag && $link->tag eq $p->{'tag'}
117 8 4 defined $p->{'tag'} and not $link->tag && $link->tag eq $p->{'tag'}
491 0 4 7 $link->tag && $link->tag =~ /$p->{'tag_regex'}/
114 7 4 defined $p->{'tag_regex'} and not $link->tag && $link->tag =~ /$p->{'tag_regex'}/
495 3 0 1 $link->attrs->{'id'} && $link->attrs->{'id'} eq $p->{'id'}
117 1 3 defined $p->{'id'} and not $link->attrs->{'id'} && $link->attrs->{'id'} eq $p->{'id'}
498 3 0 1 $link->attrs->{'id'} && $link->attrs->{'id'} =~ /$p->{'id_regex'}/
114 1 3 defined $p->{'id_regex'} and not $link->attrs->{'id'} && $link->attrs->{'id'} =~ /$p->{'id_regex'}/
501 1 0 1 $link->attrs->{'class'} && $link->attrs->{'class'} eq $p->{'class'}
113 1 1 defined $p->{'class'} and not $link->attrs->{'class'} && $link->attrs->{'class'} eq $p->{'class'}
505 1 0 1 $link->attrs->{'class'} && $link->attrs->{'class'} =~ /$p->{'class_regex'}/
112 1 1 defined $p->{'class_regex'} and not $link->attrs->{'class'} && $link->attrs->{'class'} =~ /$p->{'class_regex'}/
509 2 1 1 $link->attrs->{'rel'} && $link->attrs->{'rel'} eq $p->{'rel'}
109 1 3 defined $p->{'rel'} and not $link->attrs->{'rel'} && $link->attrs->{'rel'} eq $p->{'rel'}
512 2 0 1 $link->attrs->{'rel'} && $link->attrs->{'rel'} =~ /$p->{'rel_regex'}/
107 1 2 defined $p->{'rel_regex'} and not $link->attrs->{'rel'} && $link->attrs->{'rel'} =~ /$p->{'rel_regex'}/
586 0 11 11 defined $what && ($is_regex ? $what =~ /$criteria{$criterion}/ : $what eq $criteria{$criterion})
659 3 39 11 defined $image->url && $image->url eq $p->{'url'}
376 11 42 defined $p->{'url'} and not defined $image->url && $image->url eq $p->{'url'}
662 3 30 4 defined $image->url && $image->url =~ /$p->{'url_regex'}/
350 4 33 defined $p->{'url_regex'} and not defined $image->url && $image->url =~ /$p->{'url_regex'}/
666 0 30 2 defined $image->url_abs && $image->url_abs eq $p->{'url_abs'}
322 2 30 defined $p->{'url_abs'} and not defined $image->url_abs && $image->url_abs eq $p->{'url_abs'}
670 0 25 4 defined $image->url_abs && $image->url_abs =~ /$p->{'url_abs_regex'}/
295 4 25 defined $p->{'url_abs_regex'} and not defined $image->url_abs && $image->url_abs =~ /$p->{'url_abs_regex'}/
673 23 1 2 defined $image->alt && $image->alt eq $p->{'alt'}
273 2 24 defined $p->{'alt'} and not defined $image->alt && $image->alt eq $p->{'alt'}
676 23 1 2 defined $image->alt && $image->alt =~ /$p->{'alt_regex'}/
249 2 24 defined $p->{'alt_regex'} and not defined $image->alt && $image->alt =~ /$p->{'alt_regex'}/
678 0 39 15 $image->tag && $image->tag eq $p->{'tag'}
197 15 39 defined $p->{'tag'} and not $image->tag && $image->tag eq $p->{'tag'}
681 0 16 10 $image->tag && $image->tag =~ /$p->{'tag_regex'}/
186 10 16 defined $p->{'tag_regex'} and not $image->tag && $image->tag =~ /$p->{'tag_regex'}/
686 13 7 2 $image->attrs && $image->attrs->{'id'} && $image->attrs->{'id'} eq $p->{'id'}
167 2 27 defined $p->{'id'} and not $image->attrs && $image->attrs->{'id'} && $image->attrs->{'id'} eq $p->{'id'}
691 13 6 3 $image->attrs && $image->attrs->{'id'} && $image->attrs->{'id'} =~ /$p->{'id_regex'}/
140 3 26 defined $p->{'id_regex'} and not $image->attrs && $image->attrs->{'id'} && $image->attrs->{'id'} =~ /$p->{'id_regex'}/
696 15 5 2 $image->attrs && $image->attrs->{'class'} && $image->attrs->{'class'} eq $p->{'class'}
114 2 27 defined $p->{'class'} and not $image->attrs && $image->attrs->{'class'} && $image->attrs->{'class'} eq $p->{'class'}
701 15 7 6 $image->attrs && $image->attrs->{'class'} && $image->attrs->{'class'} =~ /$p->{'class_regex'}/
81 6 29 defined $p->{'class_regex'} and not $image->attrs && $image->attrs->{'class'} && $image->attrs->{'class'} =~ /$p->{'class_regex'}/
809 3 4 3 @fields > 1 and ref $fields[-1] eq "HASH"
857 13 0 7 @args % 2 and ref $args[-1] eq "HASH"
905 54 143 60 defined $y && $x eq $y
979 0 0 2 not ref $n and $n =~ /^\d+$/
1032 0 4 3 $input->type eq "file" and ref $value->[0] eq "ARRAY"
1224 0 6 3 $input->value and $args{'value'} eq $input->value
1406 0 0 1 length $binmode and substr($binmode, 0, 1) eq ":"
1557 1 3 4 @_ == 2 and $_[0] =~ /:\d+$/
1849 163 3 3 $onClick and $onClick =~ /^window\.open\(\s*'([^']+)'/
3 160 3 $url and $url =~ /^javascript\:\s*(?:void\(\s*)?window\.open\(\s*'([^']+)'/s
1869 3 8 7 $equiv and lc $equiv eq "refresh"
11 0 7 $equiv and lc $equiv eq "refresh" and defined $content
1924 55 0 124 $req and $res
55 3 121 $req and $res and $self->stack_depth

or 2 conditions

line l !l condition
911 30 19 $number ||= 1
939 4 9 $number ||= 1
1146 1 15 shift() || 1
1329 0 0 $args{'x'} || 0
0 0 $args{'y'} || 0
1404 1 1 delete $opts{'binmode'} || ''
1423 2 1 shift() || ''
1448 1 4 shift() || \*STDOUT
1462 1 4 shift() || \*STDOUT
1476 2 5 shift() || \*STDOUT
1487 1 1 shift() || \*STDOUT
1592 194 13 $res->content_type || ''
1927 120 1 $self->{'page_stack'} ||= []

or 3 conditions

line l !l&&r !l&&!r condition
344 1 1 0 delete $params{'base_href'} || $self->base
776 3 5 0 $args || ()
782 3 3 0 $args || ()
1032 1 3 4 $input->type ne "file" or $input->type eq "file" and ref $value->[0] eq "ARRAY"
1404 1 0 1 my $binmode = delete $opts{'binmode'} || '' or not $self->content_type =~ m[^text/]
1529 163 13 2 $request->method eq "GET" or $request->method eq "POST"
1557 0 4 4 @_ == 4 or @_ == 2 and $_[0] =~ /:\d+$/