Branch Coverage

blib/lib/Net/Async/WebSearch.pm
Criterion Covered Total %
branch 75 114 65.7


line true false branch
36 9 12 if (my $provs = delete $args->{'providers'})
51 0 0 unless %args
56 0 26 if (@_ > 1) { }
57 0 25 if (@_ > 1) { }
58 0 30 if (@_ > 1) { }
62 0 28 unless ref $p and $p->isa("Net::Async::WebSearch::Provider")
65 1 27 if ($taken{$p->name})
78 0 0 if $p->name eq $name
90 53 2 if $self->{'http'}
102 0 0 if $self->can("SUPER::_on_added_to_loop")
116 1 63 unless $p->enabled
117 34 29 if ($only and @$only)
118 15 19 unless grep {$p->matches($_);} @$only
120 18 30 if ($exclude and @$exclude)
121 7 11 if grep {$p->matches($_);} @$exclude
134 0 79 unless defined $url and length $url
135 0 79 unless my $u = eval { do { "URI"->new($url)->canonical } }
149 0 12 unless defined $url and length $url
156 0 12 if (defined $args{'timeout'})
165 11 0 $ct && $ct =~ /charset=([^\s;]+)/ ? :
167 0 11 unless defined $body
168 1 0 if (defined $args{'max_bytes'} and defined $body and length $body > $args{'max_bytes'})
172 10 1 $resp->is_success ? :
11 0 $resp->request ? :
10 1 $resp->is_success ? :
200 0 6 unless my $n = $args{'fetch'}
201 0 6 unless $results_ref and @$results_ref
202 5 1 $n < @$results_ref ? :
216 0 10 if $on_fetch
231 0 30 unless defined $query and length $query
234 0 30 unless @providers
250 2 4 unless $p->matches($sel)
268 1 28 if $args{'mode'} eq "stream"
269 2 26 if $args{'mode'} eq "race"
272 0 26 unless $futs and @$futs
291 3 0 if (ref $payload eq "HASH" and $payload->{'__error'})
295 0 32 unless $payload
297 0 70 unless length $key
302 0 70 if (not $slot->{'result'}->snippet and $r->snippet)
317 1 25 if @merged > $limit
330 5 21 if ($args{'fetch'})
346 0 2 unless my $cb = $args{'on_result'}
352 0 2 unless $futs and @$futs
376 0 9 unless length $key
377 2 7 if $seen_key->{$key}++
380 2 5 if ($fetch_cap and $fetch_started < $fetch_cap)
383 2 0 if $on_fetch
387 0 3 if $on_provider_done
392 0 0 if $on_provider_error
401 1 1 @fetch_futures ? :
412 1 1 $fetch_cap ? :
425 0 2 unless $futs and @$futs
438 1 2 if $winner->is_ready
440 0 2 if @top > $limit
460 2 0 if $winner->is_ready
472 1 1 unless $args{'fetch'}
475 0 1 unless @{$out->{'results'};}