Branch Coverage

blib/lib/Net/YAR.pm
Criterion Covered Total %
branch 8 208 3.8


line true false branch
33 1 0 unless $$self{'api_user'} or $$self{'user'}
34 1 0 unless $$self{'api_pass'} or $$self{'pass'}
35 1 0 unless $$self{'api_host'} or $$self{'host'}
36 0 0 $self->use_ssl ? :
0 0 unless $$self{'api_port'} or $$self{'port'}
37 0 0 unless $$self{'api_path'} or $$self{'path'}
38 0 0 unless $$self{'use_ssl'} or $$self{'ssl'}
39 0 0 unless (shift())->{'ssl_verify_hostname'}
42 0 0 unless ($$self{'log_obj'})
43 0 0 if (my $file = $self->log_file)
45 0 0 if (my $io = 'IO::File'->new(">>$file"))
53 0 0 unless (shift())->{'log_file'}
62 1 0 eval { do { require Data::URIEncode } } ? :
0 1 eval { do { require XML::Simple } } ? :
0 1 eval { do { require YAML } } ? :
0 1 eval { do { require YAML::Syck } } ? :
0 1 eval { do { require JSON } } ? :
81 0 0 unless $meth =~ /^[\w\.-]+$/
83 0 0 unless ($request)
94 0 0 $self->use_ssl ? :
97 0 0 unless ($$args{'authentication'})
108 0 0 if ($log_obj)
110 0 0 if ref $id eq 'ARRAY'
114 0 0 ref $$args{'lwp_args'} eq 'ARRAY' ? :
0 0 ref $$args{'lwp_args'} eq 'HASH' ? :
115 0 0 unless $$lwp_args{'ssl_opts'}
116 0 0 unless exists $$lwp_args{'ssl_opts'}{'verify_hostname'}
117 0 0 defined $$args{'retry_max'} ? :
118 0 0 defined $$args{'retry_interval'} ? :
119 0 0 if $interval < 5
122 0 0 if $resp and $resp->is_success
123 0 0 if ($retries-- > 0)
124 0 0 if ($log_obj)
133 0 0 if ($log_obj)
137 0 0 unless ($resp and $resp->is_success)
138 0 0 $resp ? :
0 0 $resp ? :
167 0 0 if ($type eq 'yaml') { }
0 0 elsif ($type eq 'json') { }
0 0 elsif ($type eq 'xml') { }
0 0 elsif ($type eq 'uri') { }
168 0 0 if (eval { do { require YAML::Syck } }) { }
176 0 0 'JSON'->VERSION > 1.98 ? :
177 0 0 if ($Net::YAR::JSON_ENCODE eq 'encode') { }
221 0 0 if (not $content) { }
0 0 elsif ($content =~ /\A \s* <\?xml /sx) { }
0 0 elsif ($content =~ /\A \s* \{ /sx) { }
0 0 elsif ($content =~ /\A ---\s+ /sx) { }
0 0 elsif ($content =~ /\A [\w\.]+= /sx) { }
236 0 0 if not $$hash{'data'} && $$hash{'data'}{$_} or ref $$hash{'data'}{$_} ne 'HASH'
243 0 0 'JSON'->VERSION > 1.98 ? :
248 0 0 if (eval { do { require YAML::Syck } }) { }
258 0 0 unless (eval { do { require Data::URIEncode } })
281 0 0 if (not $$obj_args{'type'} or $$obj_args{'type'} eq 'error' or $$obj_args{'type'} eq 'parse_error') { }
296 0 0 $Net::YAR::AUTOLOAD =~ /::([\w.]+)$/ ? :
299 0 0 if ($method =~ /^(\w+_search)_all$/) { }
0 0 elsif ($method =~ /^(\w+_search)_iter$/) { }
0 0 elsif ($method =~ /^ (domain|contact|user|util|[^\W_]+) _+ (\w+) $/x) { }
312 0 0 unless my $fails = $_[0]{'failover'}
315 0 0 if (my $default = UNIVERSAL::can("Net::YAR::$mod", 'lwp_args_yar_default'))
318 0 0 if 'ARRAY' ne ref $fails
321 0 0 if (my $code = UNIVERSAL::can("Net::YAR::$mod", $method . "_$try"))
325 0 0 if @code_refs
330 0 0 if (eval { do { $resp = $self->play_method($yar_method, @_); 1 } })
331 0 0 unless ($resp)
333 0 0 if ($failovers)
336 0 0 if (my $new_resp = eval { do { &$code($self, $resp, @_) } }) { }
345 0 0 unless $resp
351 0 0 if not UNIVERSAL::can($err, 'type') or $err->type ne 'invalid_method'
371 0 0 if (my $UNIQ_KEY = lc($$args{'unique_key'} || '')) { }
386 0 0 unless ($resp)
395 0 0 unless exists $$row{$UNIQ_KEY}
403 0 0 if (not $UNIQ{$$row{$UNIQ_KEY}}++) { }
406 0 0 if ++$i < $N_EXTRA
411 0 0 if ($PAGE == 1)
418 0 0 if (@$_rows and not $found and $PAGE > 1) { }
0 0 elsif (@$_rows > $N_ROWS) { }
442 0 0 unless ($resp)
450 0 0 if ($PAGE == 1)
480 0 0 unless ($$args{'unique_key'})
481 0 0 if (my $o = $$args{'order_by'})
482 0 0 unless ref $o eq 'ARRAY'
484 0 0 if ($field =~ /^(\w+)$/)
491 0 0 unless $$args{'unique_key'}
493 0 0 unless $response
496 0 0 unless eval { do { require DB_File; require Fcntl; my $unique_hash_file = $$args{'unique_hash_file'} || "/tmp/iter_[$$args{'unique_key'}]_$$.db"; die "${unique_hash_file}: tie: $!" unless $tie_obj = tie(%uniq, 'DB_File', $unique_hash_file, 66, 438); unlink $unique_hash_file } }
500 0 0 unless $tie_obj = tie(%uniq, 'DB_File', $unique_hash_file, 66, 438)
559 0 0 unless $$args{'yar'}
560 0 0 unless $$args{'type'} and $$args{'type'} =~ /^\w+$/
572 0 0 $Net::YAR::_ChainProxy::AUTOLOAD =~ /::(\w+)$/ ? :
601 0 0 unless (shift())->{'type'}
602 0 0 unless (shift())->{'code'}
603 0 0 unless (shift())->{'time'}
604 0 0 unless (shift())->{'data'}
605 0 0 unless (shift())->{'method'}
606 0 0 unless (shift())->{'request'}
607 0 0 unless (shift())->{'response'}
610 0 0 $self->type eq 'error' ? :
635 0 0 if ($$self{'i'} < scalar @{$response->data->{'rows'};})
641 0 0 unless exists $$result{$key}
648 0 0 unless defined $$result{$key}
649 0 0 if ($$self{'uniq'}{$$result{$key}})
657 0 0 if ($$self{'i'} >= $self->data->{'rows_per_page'})
663 0 0 if ($response)