| line |
true |
false |
branch |
|
33
|
75 |
0 |
$class eq 'WWW::Mechanize' ? : |
|
50
|
20 |
41 |
if (exists $mech_params{$key}) { } |
|
66
|
75 |
0 |
unless $mech_params{'noproxy'} |
|
70
|
0 |
75 |
unless defined $self->{'proxy'} |
|
99
|
1 |
1 |
if (defined $known_agents{$alias}) { } |
|
186
|
0 |
146 |
if ref $uri eq "WWW::Mechanize::Link" |
|
188
|
91 |
55 |
$self->base ? : |
|
200
|
1 |
3 |
unless my $req = $self->{'req'} |
|
226
|
3 |
26 |
unless $stack and @{$stack;} |
|
252
|
1 |
14 |
unless $self->{'req'} and $self->{'res'} |
|
256
|
1 |
13 |
unless $stack |
|
266
|
1 |
9 |
unless $self->{'req'} and $self->{'res'} |
|
268
|
8 |
1 |
if ($n == 0) |
|
273
|
1 |
0 |
unless $stack and @$stack >= $n |
|
288
|
53 |
1 |
$self->response ? : |
|
309
|
2 |
19 |
unless $self->is_html |
|
311
|
19 |
0 |
unless (defined $self->{'title'}) |
|
333
|
1 |
120 |
if (delete $params{'raw'}) { } |
|
|
2 |
118 |
elsif (delete $params{'decoded_by_headers'}) { } |
|
|
1 |
117 |
elsif (my $charset = delete $params{'charset'}) { } |
|
|
107 |
10 |
elsif ($self->is_html) { } |
|
343
|
2 |
105 |
if (exists $params{'base_href'}) |
|
348
|
2 |
105 |
if (my $format = delete $params{'format'}) |
|
349
|
1 |
1 |
if ($format eq 'text') { } |
|
367
|
2 |
1 |
unless (defined $self->{'text'}) |
|
368
|
2 |
0 |
unless (exists $INC{'HTML::TreeBuilder'}) |
|
396
|
30 |
54 |
unless $self->{'links'} |
|
398
|
84 |
0 |
if wantarray |
|
405
|
1 |
16 |
if @_ % 2 |
|
408
|
1 |
15 |
if ($params{'n'} eq "all") |
|
414
|
11 |
5 |
if ($link) |
|
418
|
1 |
4 |
if ($self->{'autocheck'}) |
|
437
|
3 |
71 |
unless my(@links) = $self->links |
|
442
|
108 |
463 |
if (_match_any_link_params($link, \%params)) |
|
443
|
23 |
85 |
if ($wantall) { } |
|
448
|
56 |
29 |
if $nmatches >= $params{'n'} |
|
453
|
6 |
9 |
if ($wantall) |
|
454
|
4 |
2 |
if wantarray |
|
468
|
0 |
571 |
unless keys %$p |
|
470
|
93 |
478 |
if defined $p->{'url'} and not $link->url eq $p->{'url'} |
|
471
|
63 |
415 |
if defined $p->{'url_regex'} and not $link->url =~ /$p->{'url_regex'}/ |
|
472
|
26 |
389 |
if defined $p->{'url_abs'} and not $link->url_abs eq $p->{'url_abs'} |
|
475
|
24 |
365 |
if defined $p->{'url_abs_regex'} and not $link->url_abs =~ /$p->{'url_abs_regex'}/ |
|
478
|
67 |
298 |
if defined $p->{'text'} and not defined $link->text && $link->text eq $p->{'text'} |
|
481
|
145 |
153 |
if defined $p->{'text_regex'} and not defined $link->text && $link->text =~ /$p->{'text_regex'}/ |
|
484
|
9 |
144 |
if defined $p->{'name'} and not defined $link->name && $link->name eq $p->{'name'} |
|
487
|
15 |
129 |
if defined $p->{'name_regex'} and not defined $link->name && $link->name =~ /$p->{'name_regex'}/ |
|
488
|
4 |
125 |
if defined $p->{'tag'} and not $link->tag && $link->tag eq $p->{'tag'} |
|
491
|
4 |
121 |
if defined $p->{'tag_regex'} and not $link->tag && $link->tag =~ /$p->{'tag_regex'}/ |
|
495
|
3 |
118 |
if defined $p->{'id'} and not $link->attrs->{'id'} && $link->attrs->{'id'} eq $p->{'id'} |
|
498
|
3 |
115 |
if defined $p->{'id_regex'} and not $link->attrs->{'id'} && $link->attrs->{'id'} =~ /$p->{'id_regex'}/ |
|
501
|
1 |
114 |
if defined $p->{'class'} and not $link->attrs->{'class'} && $link->attrs->{'class'} eq $p->{'class'} |
|
505
|
1 |
113 |
if defined $p->{'class_regex'} and not $link->attrs->{'class'} && $link->attrs->{'class'} =~ /$p->{'class_regex'}/ |
|
509
|
3 |
110 |
if defined $p->{'rel'} and not $link->attrs->{'rel'} && $link->attrs->{'rel'} eq $p->{'rel'} |
|
512
|
2 |
108 |
if defined $p->{'rel_regex'} and not $link->attrs->{'rel'} && $link->attrs->{'rel'} =~ /$p->{'rel_regex'}/ |
|
527
|
5 |
233 |
unless ($key =~ qr/$rx_keyname/) |
|
536
|
49 |
184 |
if ($key_regex) { } |
|
537
|
6 |
43 |
unless ($val_regex) |
|
544
|
5 |
179 |
if ($val_regex) |
|
549
|
5 |
174 |
if ($val =~ /^\s|\s$/) |
|
571
|
0 |
8 |
unless my $form = $self->current_form |
|
588
|
11 |
11 |
unless $matched |
|
590
|
23 |
11 |
if $matched |
|
606
|
7 |
51 |
unless $self->{'images'} |
|
608
|
57 |
1 |
if wantarray |
|
624
|
0 |
50 |
unless my(@images) = $self->images |
|
629
|
87 |
342 |
if (_match_any_image_params($image, \%params)) |
|
630
|
66 |
21 |
if ($wantall) { } |
|
635
|
20 |
1 |
if $nmatches >= $params{'n'} |
|
640
|
18 |
12 |
if ($wantall) |
|
641
|
17 |
1 |
if wantarray |
|
655
|
0 |
429 |
unless keys %$p |
|
659
|
42 |
387 |
if defined $p->{'url'} and not defined $image->url && $image->url eq $p->{'url'} |
|
662
|
33 |
354 |
if defined $p->{'url_regex'} and not defined $image->url && $image->url =~ /$p->{'url_regex'}/ |
|
666
|
30 |
324 |
if defined $p->{'url_abs'} and not defined $image->url_abs && $image->url_abs eq $p->{'url_abs'} |
|
670
|
25 |
299 |
if defined $p->{'url_abs_regex'} and not defined $image->url_abs && $image->url_abs =~ /$p->{'url_abs_regex'}/ |
|
673
|
24 |
275 |
if defined $p->{'alt'} and not defined $image->alt && $image->alt eq $p->{'alt'} |
|
676
|
24 |
251 |
if defined $p->{'alt_regex'} and not defined $image->alt && $image->alt =~ /$p->{'alt_regex'}/ |
|
678
|
39 |
212 |
if defined $p->{'tag'} and not $image->tag && $image->tag eq $p->{'tag'} |
|
681
|
16 |
196 |
if defined $p->{'tag_regex'} and not $image->tag && $image->tag =~ /$p->{'tag_regex'}/ |
|
686
|
27 |
169 |
if defined $p->{'id'} and not $image->attrs && $image->attrs->{'id'} && $image->attrs->{'id'} eq $p->{'id'} |
|
691
|
26 |
143 |
if defined $p->{'id_regex'} and not $image->attrs && $image->attrs->{'id'} && $image->attrs->{'id'} =~ /$p->{'id_regex'}/ |
|
696
|
27 |
116 |
if defined $p->{'class'} and not $image->attrs && $image->attrs->{'class'} && $image->attrs->{'class'} eq $p->{'class'} |
|
701
|
29 |
87 |
if defined $p->{'class_regex'} and not $image->attrs && $image->attrs->{'class'} && $image->attrs->{'class'} =~ /$p->{'class_regex'}/ |
|
717
|
79 |
82 |
unless $self->{'forms'} |
|
719
|
68 |
91 |
if wantarray |
|
726
|
31 |
136 |
unless ($self->{'current_form'}) |
|
740
|
49 |
2 |
if ($$forms[$form - 1]) |
|
744
|
1 |
48 |
wantarray ? : |
|
747
|
0 |
2 |
wantarray ? : |
|
756
|
15 |
0 |
if defined($temp = $_->action) |
|
761
|
2 |
1 |
if ($nmatches > 0) |
|
762
|
1 |
1 |
if ($nmatches > 1) |
|
782
|
2 |
4 |
unless defined(my $form = $self->form_with("id", $formid, $args || ())) |
|
790
|
1 |
20 |
unless scalar @fields |
|
796
|
124 |
46 |
unless grep {$_ eq $field;} @fields_in_form |
|
806
|
2 |
10 |
unless scalar @fields |
|
809
|
3 |
7 |
if (@fields > 1 and ref $fields[-1] eq "HASH") |
|
814
|
3 |
7 |
if ($nth) |
|
815
|
2 |
1 |
@matches >= $nth ? : |
|
818
|
9 |
1 |
if ($nmatches > 0) { } |
|
819
|
4 |
5 |
if ($nmatches > 1) |
|
827
|
1 |
0 |
$nth ? : |
|
841
|
23 |
247 |
unless not $action |
|
843
|
5 |
40 |
unless @forms = grep(_equal($spec{$attr}, $_->attr($attr)), @forms) |
|
853
|
0 |
20 |
unless $self->forms |
|
857
|
7 |
13 |
if (@args % 2 and ref $args[-1] eq "HASH") |
|
864
|
7 |
13 |
if ($nth) |
|
865
|
5 |
2 |
@forms >= $nth ? : |
|
867
|
3 |
17 |
if (@forms > 1) |
|
878
|
1 |
3 |
do {
$spec{$_} eq ''
} ? : |
|
|
4 |
1 |
defined $spec{$_} ? : |
|
|
3 |
0 |
keys %spec ? : |
|
905
|
257 |
9 |
defined $x ? : |
|
914
|
0 |
49 |
if ($number > 1) { } |
|
918
|
11 |
38 |
if (ref $value eq 'ARRAY') { } |
|
921
|
10 |
1 |
if ($input->type eq 'file') { } |
|
944
|
1 |
12 |
unless ($input) |
|
949
|
0 |
12 |
if ($input->type ne "option") |
|
956
|
4 |
8 |
if (ref $value eq "HASH") |
|
958
|
0 |
4 |
unless $_ eq "n" |
|
962
|
4 |
0 |
if (defined $value->{'n'}) { } |
|
968
|
2 |
2 |
if (@inputs == 1) { } |
|
979
|
2 |
2 |
if (ref $n eq 'ARRAY') { } |
|
|
2 |
0 |
elsif (not ref $n and $n =~ /^\d+$/) { } |
|
982
|
0 |
4 |
unless (/^\d+$/) |
|
1005
|
4 |
8 |
if (ref $value eq "ARRAY") |
|
1019
|
0 |
27 |
unless my $form = $self->current_form |
|
1026
|
9 |
23 |
if (ref $value eq 'ARRAY') { } |
|
1027
|
1 |
8 |
unless my $input = $form->find_input($field) |
|
1032
|
4 |
4 |
if ($input->type ne "file" or $input->type eq "file" and ref $value->[0] eq "ARRAY") |
|
1040
|
2 |
21 |
if (ref $value eq "SCALAR") |
|
1043
|
0 |
2 |
unless (defined int $$value) |
|
1050
|
0 |
2 |
if ($#possible_values < $$value) |
|
1073
|
1 |
3 |
if (ref $value eq 'ARRAY') { } |
|
1076
|
0 |
3 |
if $input->type eq "hidden" |
|
1077
|
1 |
2 |
if ($input->type eq $type) |
|
1088
|
0 |
3 |
if $input->type eq "hidden" |
|
1104
|
1 |
4 |
@_ ? : |
|
1114
|
1 |
4 |
if ($value eq "") |
|
1115
|
1 |
0 |
$set ? : |
|
1122
|
4 |
4 |
unless defined $val |
|
1123
|
3 |
1 |
if ($val eq $value) |
|
1124
|
2 |
1 |
$set ? : |
|
1149
|
1 |
15 |
if ($number > 1) { } |
|
1160
|
4 |
0 |
unless defined $_ |
|
1171
|
0 |
18 |
unless (/^(number|name|value|id|input|x|y)$/) |
|
1185
|
2 |
16 |
unless $_ |
|
1187
|
1 |
14 |
if (scalar @present_exclusive_options > 1) |
|
1193
|
26 |
2 |
unless defined $_ |
|
1196
|
0 |
13 |
unless my $form = $self->current_form |
|
1200
|
4 |
9 |
if ($args{'name'}) { } |
|
|
2 |
7 |
elsif (defined $args{'id'}) { } |
|
|
2 |
5 |
elsif ($args{'number'}) { } |
|
|
1 |
4 |
elsif ($args{'input'}) { } |
|
|
4 |
0 |
elsif ($args{'value'}) { } |
|
1224
|
3 |
6 |
if ($input->value and $args{'value'} eq $input->value) |
|
1247
|
1 |
60 |
unless (/^(form_(number|name|fields|id)|(with_)?fields|button|x|y|strict_forms)$/) |
|
1256
|
26 |
34 |
if ($args{$_}) |
|
1257
|
24 |
2 |
if (ref $args{$_} eq 'HASH') { } |
|
1268
|
11 |
23 |
if ($args{'with_fields'}) |
|
1270
|
2 |
8 |
unless @got |
|
1273
|
9 |
22 |
if (my $form_number = $args{'form_number'}) |
|
1275
|
1 |
7 |
unless $got |
|
1278
|
17 |
12 |
if (my $form_name = $args{'form_name'}) |
|
1280
|
1 |
16 |
unless @got |
|
1283
|
2 |
26 |
if (my $form_id = $args{'form_id'}) |
|
1285
|
1 |
1 |
unless @got |
|
1289
|
1 |
26 |
if (not @filtered_sets) { } |
|
1299
|
0 |
26 |
unless tie my %c, "Tie::RefHash" |
|
1308
|
4 |
22 |
unless (@matched) |
|
1311
|
2 |
20 |
if (@matched > 1) |
|
1317
|
6 |
15 |
if (defined $args{'strict_forms'}) |
|
1324
|
18 |
3 |
if $fields |
|
1327
|
0 |
17 |
if ($args{'button'}) { } |
|
1371
|
9 |
38 |
if @_ |
|
1380
|
2 |
4 |
if @_ |
|
1388
|
3 |
246 |
if @_ |
|
1397
|
1 |
1 |
if (delete $opts{'binary'}) |
|
1402
|
0 |
2 |
unless open my $fh, ">", $filename |
|
1404
|
1 |
1 |
if (my $binmode = delete $opts{'binmode'} || '' or not $self->content_type =~ m[^text/]) |
|
1406
|
1 |
0 |
if (length $binmode and substr($binmode, 0, 1) eq ':') { } |
|
1413
|
0 |
2 |
unless print {$fh;} $self->content(%opts) |
|
1415
|
0 |
2 |
unless close $fh |
|
1424
|
1 |
2 |
if (not $p) { } |
|
|
1 |
1 |
elsif (not ref $p) { } |
|
1428
|
0 |
1 |
unless open my $fh, ">", $p |
|
1452
|
0 |
64 |
$absolute ? : |
|
1453
|
0 |
64 |
unless defined $url |
|
1466
|
0 |
26 |
$absolute ? : |
|
1467
|
3 |
23 |
unless defined $url |
|
1512
|
1 |
0 |
if ($ok) |
|
1524
|
2 |
178 |
unless $request |
|
1529
|
176 |
2 |
if ($request->method eq "GET" or $request->method eq "POST") |
|
1557
|
4 |
4 |
if (@_ == 4 or @_ == 2 and $_[0] =~ /:\d+$/) |
|
1561
|
1 |
3 |
unless @_ == 2 |
|
1571
|
5 |
4 |
if @cred == 2 |
|
1594
|
189 |
18 |
if ($res->is_success) |
|
1599
|
18 |
189 |
if ($res->is_error) |
|
1600
|
2 |
16 |
if ($self->{'autocheck'}) |
|
1613
|
0 |
205 |
unless defined $content |
|
1615
|
179 |
26 |
if ($self->is_html) { } |
|
1633
|
178 |
2 |
unless ($req->header("Accept-Encoding")) |
|
1636
|
178 |
0 |
$HAS_ZLIB ? : |
|
1640
|
121 |
59 |
if ($last) |
|
1641
|
0 |
121 |
if ref $last |
|
1645
|
4 |
1 |
if (defined $value) { } |
|
1702
|
28 |
2 |
if (defined $self->{'content'}) |
|
1706
|
208 |
15 |
if $link |
|
1723
|
7 |
0 |
if (defined $self->{'content'}) |
|
1724
|
1 |
6 |
if ($self->content_type eq 'text/css') { } |
|
1734
|
99 |
160 |
if $tag_name =~ m[^/] |
|
1736
|
50 |
110 |
if ($image_tags{$tag_name}) { } |
|
|
4 |
106 |
elsif ($tag_name eq 'style') { } |
|
1738
|
29 |
21 |
if $image |
|
1747
|
10 |
150 |
if ($attrs->{'style'}) |
|
1767
|
24 |
26 |
if ($tag eq "input") |
|
1768
|
1 |
23 |
unless my $type = $attrs->{'type'} |
|
1769
|
20 |
3 |
unless $type eq "image" |
|
1844
|
169 |
54 |
if ($tag eq "a") |
|
1846
|
0 |
169 |
unless defined $text |
|
1849
|
3 |
166 |
if ($onClick and $onClick =~ /^window\.open\(\s*'([^']+)'/) { } |
|
|
3 |
166 |
elsif ($url and $url =~ /^javascript\:\s*(?:void\(\s*)?window\.open\(\s*'([^']+)'/s) { } |
|
1865
|
18 |
205 |
if ($tag eq "meta") |
|
1869
|
8 |
7 |
unless $equiv and lc $equiv eq "refresh" and defined $content |
|
1871
|
7 |
0 |
if ($content =~ /^\d+\s*;\s*url\s*=\s*(\S+)/i) { } |
|
1873
|
7 |
0 |
unless $url =~ s/^"(.+)"$/$1/ |
|
1881
|
4 |
208 |
unless defined $url |
|
1908
|
29 |
1154 |
if ($input->type eq "file") |
|
1924
|
3 |
121 |
unless $req and $res and $self->stack_depth |
|
1928
|
2 |
119 |
if (@{$stack;} >= $self->stack_depth) |
|
1940
|
0 |
38 |
unless my $handler = $self->{'onwarn'} |
|
1942
|
6 |
32 |
if $self->quiet |
|
1951
|
1 |
29 |
unless my $handler = $self->{'onerror'} |