Branch Coverage

blib/lib/WWW/Google/Translate.pm
Criterion Covered Total %
branch 32 82 39.0


line true false branch
52 3 33 if (exists $$param_rh{$property})
57 0 3 if $expected_type ne $type
71 9 0 unless ($self{$default})
77 0 3 if (exists $self{'cache_results'})
81 0 0 if ($tmpdir) { }
86 0 0 if (stat $self{'cache_file'})
88 0 0 unless -w $self{'cache_file'}
91 0 0 unless -r $self{'cache_file'}
103 0 3 unless $self{'key'}
106 0 3 unless $self{'data_format'} =~ /\A (?: perl|json ) \z/imsx
112 0 3 if (keys %{$self{'headers'};})
123 0 1 unless exists $$arg_rh{'q'}
128 1 0 if ($$arg_rh{'q'})
147 0 1 if @unsupported
150 0 1 unless (exists $$arg_rh{'prettyprint'})
152 0 0 if ($$self{'prettyprint'})
158 0 1 unless (exists $$arg_rh{'format'})
160 0 0 if ($$self{'format'}) { }
0 0 elsif ($$arg_rh{'q'} =~ / < [^>]+ > /msx) { }
176 0 1 if (exists $$self{'cache_rh'})
184 0 0 if exists $$self{'cache_rh'}{$cache_key}
190 0 1 if ($cache_key)
196 0 0 if ($count % 10 == 0)
209 0 1 unless exists $$arg_rh{'target'}
214 1 0 if ($$arg_rh{'target'})
218 0 1 if @unsupported
230 0 1 unless exists $$arg_rh{'q'}
235 1 0 if ($$arg_rh{'q'})
239 0 1 if @unsupported
251 1 2 $operation eq 'translate' ? :
263 0 3 if (exists $$arg_rh{'source'} and not $$arg_rh{'source'})
269 2 1 exists $form{'q'} ? :
274 0 3 if ($force_post or $byte_size > $get_size_limit) { }
301 0 3 if ($response->code == 400) { }
0 3 elsif (not $response->is_success) { }
325 0 3 if 'json' eq lc $$self{'data_format'}
334 0 3 if ($WWW::Google::Translate::EVAL_ERROR)
346 3 0 unless exists $$self{'cache_rh'} and exists $$self{'cache_file'}
350 0 0 unless open $fh, '>', $$self{'cache_file'}
358 0 0 unless print {$fh;} Dumper($$self{'cache_rh'})
361 0 0 unless close $fh