| line |
true |
false |
branch |
|
33
|
75 |
0 |
$class eq 'WWW::Mechanize' ? : |
|
50
|
19 |
41 |
if (exists $mech_params{$key}) { } |
|
66
|
75 |
0 |
unless $mech_params{'noproxy'} |
|
70
|
0 |
75 |
unless defined $self->{'proxy'} |
|
95
|
1 |
1 |
if (defined $known_agents{$alias}) { } |
|
183
|
0 |
144 |
if ref $uri eq "WWW::Mechanize::Link" |
|
185
|
89 |
55 |
$self->base ? : |
|
196
|
1 |
3 |
unless my $req = $self->{'req'} |
|
222
|
3 |
25 |
unless $stack and @{$stack;} |
|
248
|
1 |
14 |
unless $self->{'req'} and $self->{'res'} |
|
252
|
1 |
13 |
unless $stack |
|
262
|
1 |
9 |
unless $self->{'req'} and $self->{'res'} |
|
264
|
8 |
1 |
if ($n == 0) |
|
269
|
1 |
0 |
unless $stack and @$stack >= $n |
|
285
|
50 |
1 |
$self->response ? : |
|
304
|
2 |
21 |
unless $self->is_html |
|
306
|
20 |
1 |
unless (defined $self->{'title'}) |
|
328
|
1 |
118 |
if (delete $params{'raw'}) { } |
|
|
2 |
116 |
elsif (delete $params{'decoded_by_headers'}) { } |
|
|
1 |
115 |
elsif (my $charset = delete $params{'charset'}) { } |
|
|
106 |
9 |
elsif ($self->is_html) { } |
|
338
|
2 |
104 |
if (exists $params{'base_href'}) |
|
343
|
2 |
104 |
if (my $format = delete $params{'format'}) |
|
344
|
1 |
1 |
if ($format eq 'text') { } |
|
362
|
2 |
1 |
unless (defined $self->{'text'}) |
|
363
|
2 |
0 |
unless (exists $INC{'HTML::TreeBuilder'}) |
|
391
|
27 |
54 |
unless $self->{'links'} |
|
393
|
81 |
0 |
if wantarray |
|
400
|
1 |
16 |
if @_ % 2 |
|
403
|
1 |
15 |
if ($params{'n'} eq "all") |
|
409
|
11 |
5 |
if ($link) |
|
413
|
1 |
4 |
if ($self->{'autocheck'}) |
|
429
|
3 |
71 |
unless my(@links) = $self->links |
|
434
|
108 |
463 |
if (_match_any_link_params($link, \%params)) |
|
435
|
23 |
85 |
if ($wantall) { } |
|
440
|
56 |
29 |
if $nmatches >= $params{'n'} |
|
445
|
6 |
9 |
if ($wantall) |
|
446
|
4 |
2 |
if wantarray |
|
460
|
0 |
571 |
unless keys %$p |
|
462
|
93 |
478 |
if defined $p->{'url'} and not $link->url eq $p->{'url'} |
|
463
|
63 |
415 |
if defined $p->{'url_regex'} and not $link->url =~ /$p->{'url_regex'}/ |
|
464
|
26 |
389 |
if defined $p->{'url_abs'} and not $link->url_abs eq $p->{'url_abs'} |
|
465
|
24 |
365 |
if defined $p->{'url_abs_regex'} and not $link->url_abs =~ /$p->{'url_abs_regex'}/ |
|
466
|
67 |
298 |
if defined $p->{'text'} and not defined $link->text && $link->text eq $p->{'text'} |
|
467
|
145 |
153 |
if defined $p->{'text_regex'} and not defined $link->text && $link->text =~ /$p->{'text_regex'}/ |
|
468
|
9 |
144 |
if defined $p->{'name'} and not defined $link->name && $link->name eq $p->{'name'} |
|
469
|
15 |
129 |
if defined $p->{'name_regex'} and not defined $link->name && $link->name =~ /$p->{'name_regex'}/ |
|
470
|
4 |
125 |
if defined $p->{'tag'} and not $link->tag && $link->tag eq $p->{'tag'} |
|
471
|
4 |
121 |
if defined $p->{'tag_regex'} and not $link->tag && $link->tag =~ /$p->{'tag_regex'}/ |
|
473
|
3 |
118 |
if defined $p->{'id'} and not $link->attrs->{'id'} && $link->attrs->{'id'} eq $p->{'id'} |
|
474
|
3 |
115 |
if defined $p->{'id_regex'} and not $link->attrs->{'id'} && $link->attrs->{'id'} =~ /$p->{'id_regex'}/ |
|
475
|
1 |
114 |
if defined $p->{'class'} and not $link->attrs->{'class'} && $link->attrs->{'class'} eq $p->{'class'} |
|
476
|
1 |
113 |
if defined $p->{'class_regex'} and not $link->attrs->{'class'} && $link->attrs->{'class'} =~ /$p->{'class_regex'}/ |
|
478
|
3 |
110 |
if defined $p->{'rel'} and not $link->attrs->{'rel'} && $link->attrs->{'rel'} eq $p->{'rel'} |
|
479
|
2 |
108 |
if defined $p->{'rel_regex'} and not $link->attrs->{'rel'} && $link->attrs->{'rel'} =~ /$p->{'rel_regex'}/ |
|
494
|
5 |
233 |
unless ($key =~ qr/$rx_keyname/) |
|
503
|
49 |
184 |
if ($key_regex) { } |
|
504
|
6 |
43 |
unless ($val_regex) |
|
511
|
5 |
179 |
if ($val_regex) |
|
516
|
5 |
174 |
if ($val =~ /^\s|\s$/) |
|
539
|
0 |
8 |
unless my $form = $self->current_form |
|
553
|
11 |
11 |
unless $matched |
|
555
|
23 |
11 |
if $matched |
|
572
|
4 |
51 |
unless $self->{'images'} |
|
574
|
54 |
1 |
if wantarray |
|
587
|
0 |
50 |
unless my(@images) = $self->images |
|
592
|
87 |
342 |
if (_match_any_image_params($image, \%params)) |
|
593
|
66 |
21 |
if ($wantall) { } |
|
598
|
20 |
1 |
if $nmatches >= $params{'n'} |
|
603
|
18 |
12 |
if ($wantall) |
|
604
|
17 |
1 |
if wantarray |
|
618
|
0 |
429 |
unless keys %$p |
|
620
|
42 |
387 |
if defined $p->{'url'} and not defined $image->url && $image->url eq $p->{'url'} |
|
621
|
33 |
354 |
if defined $p->{'url_regex'} and not defined $image->url && $image->url =~ /$p->{'url_regex'}/ |
|
622
|
30 |
324 |
if defined $p->{'url_abs'} and not defined $image->url_abs && $image->url_abs eq $p->{'url_abs'} |
|
623
|
25 |
299 |
if defined $p->{'url_abs_regex'} and not defined $image->url_abs && $image->url_abs =~ /$p->{'url_abs_regex'}/ |
|
624
|
24 |
275 |
if defined $p->{'alt'} and not defined $image->alt && $image->alt eq $p->{'alt'} |
|
625
|
24 |
251 |
if defined $p->{'alt_regex'} and not defined $image->alt && $image->alt =~ /$p->{'alt_regex'}/ |
|
626
|
39 |
212 |
if defined $p->{'tag'} and not $image->tag && $image->tag eq $p->{'tag'} |
|
627
|
16 |
196 |
if defined $p->{'tag_regex'} and not $image->tag && $image->tag =~ /$p->{'tag_regex'}/ |
|
628
|
27 |
169 |
if defined $p->{'id'} and not $image->attrs && $image->attrs->{'id'} && $image->attrs->{'id'} eq $p->{'id'} |
|
629
|
26 |
143 |
if defined $p->{'id_regex'} and not $image->attrs && $image->attrs->{'id'} && $image->attrs->{'id'} =~ /$p->{'id_regex'}/ |
|
630
|
27 |
116 |
if defined $p->{'class'} and not $image->attrs && $image->attrs->{'class'} && $image->attrs->{'class'} eq $p->{'class'} |
|
631
|
29 |
87 |
if defined $p->{'class_regex'} and not $image->attrs && $image->attrs->{'class'} && $image->attrs->{'class'} =~ /$p->{'class_regex'}/ |
|
648
|
75 |
82 |
unless $self->{'forms'} |
|
650
|
65 |
90 |
if wantarray |
|
657
|
30 |
132 |
unless ($self->{'current_form'}) |
|
670
|
48 |
2 |
if ($$forms[$form - 1]) |
|
674
|
1 |
47 |
wantarray ? : |
|
677
|
0 |
2 |
wantarray ? : |
|
685
|
15 |
0 |
if defined($temp = $_->action) |
|
688
|
2 |
1 |
if ($nmatches > 0) |
|
689
|
1 |
1 |
if ($nmatches > 1) |
|
707
|
2 |
4 |
unless defined(my $form = $self->form_with("id", $formid, $args || ())) |
|
716
|
1 |
20 |
unless scalar @fields |
|
722
|
124 |
46 |
unless grep {$_ eq $field;} @fields_in_form |
|
733
|
2 |
10 |
unless scalar @fields |
|
736
|
3 |
7 |
if (@fields > 1 and ref $fields[-1] eq "HASH") |
|
741
|
3 |
7 |
if ($nth) |
|
742
|
2 |
1 |
@matches >= $nth ? : |
|
745
|
9 |
1 |
if ($nmatches > 0) { } |
|
746
|
4 |
5 |
if ($nmatches > 1) |
|
752
|
1 |
0 |
$nth ? : |
|
764
|
23 |
247 |
unless not $action |
|
766
|
5 |
40 |
unless @forms = grep(_equal($spec{$attr}, $_->attr($attr)), @forms) |
|
775
|
0 |
20 |
unless $self->forms |
|
779
|
7 |
13 |
if (@args % 2 and ref $args[-1] eq "HASH") |
|
786
|
7 |
13 |
if ($nth) |
|
787
|
5 |
2 |
@forms >= $nth ? : |
|
789
|
3 |
17 |
if (@forms > 1) |
|
800
|
1 |
3 |
do {
$spec{$_} eq ''
} ? : |
|
|
4 |
1 |
defined $spec{$_} ? : |
|
|
3 |
0 |
keys %spec ? : |
|
826
|
257 |
11 |
defined $x ? : |
|
836
|
0 |
49 |
if ($number > 1) { } |
|
840
|
11 |
38 |
if (ref $value eq 'ARRAY') { } |
|
843
|
10 |
1 |
if ($input->type eq 'file') { } |
|
865
|
1 |
8 |
unless ($input) |
|
870
|
0 |
8 |
if ($input->type ne "option") |
|
877
|
4 |
4 |
if (ref $value eq "HASH") |
|
879
|
0 |
4 |
unless $_ eq "n" |
|
883
|
4 |
0 |
if (defined $value->{'n'}) { } |
|
888
|
2 |
2 |
if (@inputs == 1) { } |
|
899
|
2 |
2 |
if (ref $n eq 'ARRAY') { } |
|
|
2 |
0 |
elsif (not ref $n and $n =~ /^\d+$/) { } |
|
902
|
0 |
4 |
unless (/^\d+$/) |
|
923
|
4 |
4 |
if (ref $value eq "ARRAY") |
|
937
|
0 |
27 |
unless my $form = $self->current_form |
|
944
|
9 |
23 |
if (ref $value eq 'ARRAY') { } |
|
945
|
1 |
8 |
unless my $input = $form->find_input($field) |
|
950
|
4 |
4 |
if ($input->type ne "file" or $input->type eq "file" and ref $value->[0] eq "ARRAY") |
|
958
|
2 |
21 |
if (ref $value eq "SCALAR") |
|
961
|
0 |
2 |
unless (defined int $$value) |
|
967
|
0 |
2 |
if ($#possible_values < $$value) |
|
988
|
1 |
3 |
if (ref $value eq 'ARRAY') { } |
|
991
|
0 |
3 |
if $input->type eq "hidden" |
|
992
|
1 |
2 |
if ($input->type eq $type) |
|
1002
|
0 |
3 |
if $input->type eq "hidden" |
|
1018
|
1 |
4 |
@_ ? : |
|
1026
|
1 |
4 |
if ($value eq "") |
|
1027
|
1 |
0 |
$set ? : |
|
1033
|
4 |
4 |
unless defined $val |
|
1034
|
3 |
1 |
if ($val eq $value) |
|
1035
|
2 |
1 |
$set ? : |
|
1060
|
1 |
15 |
if ($number > 1) { } |
|
1071
|
4 |
0 |
unless defined $_ |
|
1082
|
0 |
15 |
unless (/^(number|name|value|id|input|x|y)$/) |
|
1097
|
1 |
13 |
if (scalar @present_exclusive_options > 1) |
|
1102
|
26 |
0 |
unless defined $_ |
|
1105
|
0 |
12 |
unless my $form = $self->current_form |
|
1108
|
3 |
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'}) { } |
|
1128
|
3 |
6 |
if ($input->value and $args{'value'} eq $input->value) |
|
1151
|
1 |
60 |
unless (/^(form_(number|name|fields|id)|(with_)?fields|button|x|y|strict_forms)$/) |
|
1158
|
26 |
34 |
if ($args{$_}) |
|
1159
|
24 |
2 |
if (ref $args{$_} eq 'HASH') { } |
|
1170
|
11 |
23 |
if ($args{'with_fields'}) |
|
1172
|
2 |
8 |
unless @got |
|
1175
|
9 |
22 |
if (my $form_number = $args{'form_number'}) |
|
1177
|
1 |
7 |
unless $got |
|
1180
|
17 |
12 |
if (my $form_name = $args{'form_name'}) |
|
1182
|
1 |
16 |
unless @got |
|
1185
|
2 |
26 |
if (my $form_id = $args{'form_id'}) |
|
1187
|
1 |
1 |
unless @got |
|
1191
|
1 |
26 |
if (not @filtered_sets) { } |
|
1200
|
0 |
26 |
unless tie my %c, "Tie::RefHash" |
|
1208
|
4 |
22 |
unless (@matched) |
|
1211
|
2 |
20 |
if (@matched > 1) |
|
1217
|
6 |
15 |
if (defined $args{'strict_forms'}) |
|
1223
|
18 |
3 |
if $fields |
|
1226
|
0 |
17 |
if ($args{'button'}) { } |
|
1270
|
9 |
38 |
if @_ |
|
1279
|
2 |
4 |
if @_ |
|
1287
|
3 |
240 |
if @_ |
|
1296
|
1 |
1 |
if (delete $opts{'binary'}) |
|
1301
|
0 |
2 |
unless open my $fh, ">", $filename |
|
1302
|
1 |
1 |
if (my $binmode = delete $opts{'binmode'} || '' or not $self->content_type =~ m[^text/]) |
|
1303
|
1 |
0 |
if (length $binmode and substr($binmode, 0, 1) eq ':') { } |
|
1310
|
0 |
2 |
unless print {$fh;} $self->content(%opts) |
|
1311
|
0 |
2 |
unless close $fh |
|
1321
|
1 |
2 |
if (not $p) { } |
|
|
1 |
1 |
elsif (not ref $p) { } |
|
1324
|
0 |
1 |
unless open my $fh, ">", $p |
|
1348
|
0 |
52 |
$absolute ? : |
|
1349
|
0 |
52 |
unless defined $url |
|
1362
|
0 |
24 |
$absolute ? : |
|
1363
|
2 |
22 |
unless defined $url |
|
1411
|
1 |
0 |
if ($ok) |
|
1424
|
2 |
175 |
unless $request |
|
1429
|
173 |
2 |
if ($request->method eq "GET" or $request->method eq "POST") |
|
1454
|
4 |
4 |
if (@_ == 4 or @_ == 2 and $_[0] =~ /:\d+$/) |
|
1458
|
1 |
3 |
unless @_ == 2 |
|
1468
|
5 |
4 |
if @cred == 2 |
|
1491
|
186 |
17 |
if ($res->is_success) |
|
1496
|
17 |
186 |
if ($res->is_error) |
|
1497
|
2 |
15 |
if ($self->{'autocheck'}) |
|
1507
|
0 |
201 |
unless defined $content |
|
1511
|
177 |
24 |
if ($self->is_html) { } |
|
1525
|
158 |
43 |
if defined $_taintbrush |
|
1533
|
19 |
24 |
if &tainted($_taintbrush) |
|
1537
|
0 |
24 |
if &tainted($_taintbrush) |
|
1543
|
4846 |
0 |
if (open my $fh, "<", $filename) |
|
1545
|
4774 |
72 |
if (defined sysread($fh, $data, 1)) |
|
1547
|
0 |
4774 |
if &tainted($_taintbrush) |
|
1553
|
0 |
24 |
if length $_taintbrush |
|
1567
|
175 |
2 |
unless ($req->header("Accept-Encoding")) |
|
1569
|
175 |
0 |
$HAS_ZLIB ? : |
|
1573
|
118 |
59 |
if ($last) |
|
1574
|
0 |
118 |
if ref $last |
|
1578
|
4 |
1 |
if (defined $value) { } |
|
1636
|
25 |
2 |
if (defined $self->{'content'}) |
|
1640
|
196 |
14 |
if $link |
|
1658
|
4 |
0 |
if (defined $self->{'content'}) |
|
1659
|
1 |
3 |
if ($self->content_type eq 'text/css') { } |
|
1666
|
36 |
66 |
if $tag_name =~ m[^/] |
|
1668
|
30 |
36 |
if ($image_tags{$tag_name}) { } |
|
|
3 |
33 |
elsif ($tag_name eq 'style') { } |
|
1670
|
27 |
3 |
if $image |
|
1676
|
6 |
60 |
if ($attrs->{'style'}) |
|
1694
|
6 |
24 |
if ($tag eq "input") |
|
1695
|
0 |
6 |
unless my $type = $attrs->{'type'} |
|
1696
|
3 |
3 |
unless $type eq "image" |
|
1768
|
157 |
53 |
if ($tag eq "a") |
|
1770
|
0 |
157 |
unless defined $text |
|
1773
|
3 |
154 |
if ($onClick and $onClick =~ /^window\.open\(\s*'([^']+)'/) { } |
|
|
3 |
154 |
elsif ($url and $url =~ /^javascript\:\s*(?:void\(\s*)?window\.open\(\s*'([^']+)'/s) { } |
|
1787
|
17 |
193 |
if ($tag eq "meta") |
|
1790
|
7 |
7 |
unless $equiv and lc $equiv eq "refresh" and defined $content |
|
1792
|
7 |
0 |
if ($content =~ /^\d+\s*;\s*url\s*=\s*(\S+)/i) { } |
|
1794
|
7 |
0 |
unless $url =~ s/^"(.+)"$/$1/ |
|
1801
|
4 |
196 |
unless defined $url |
|
1828
|
28 |
1121 |
if ($input->type eq "file") |
|
1844
|
3 |
118 |
unless $req and $res and $self->stack_depth |
|
1848
|
2 |
116 |
if (@{$stack;} >= $self->stack_depth) |
|
1860
|
0 |
38 |
unless my $handler = $self->{'onwarn'} |
|
1862
|
6 |
32 |
if $self->quiet |
|
1871
|
1 |
29 |
unless my $handler = $self->{'onerror'} |