Branch Coverage

blib/lib/Weather/Underground.pm
Criterion Covered Total %
branch 59 136 43.3


line true false branch
277 0 2 if (ref $_[0] eq 'HASH') { }
286 0 2 unless ($parameters{'place'})
295 0 2 if ($parameters{'cache_max_age'} and $parameters{'cache_file'}) { }
0 2 elsif ($parameters{'cache_max_age'} or $parameters{'cache_file'}) { }
300 0 0 unless (grep {$_;} values %Weather::Underground::MODULES)
304 0 0 unless ($parameters{'cache_max_age'} =~ /^[0-9.]+$/)
308 0 0 if (-f $parameters{'cache_file'}) { }
313 0 0 unless (open FH, $parameters{'cache_file'})
317 0 0 unless (flock FH, 2)
322 0 0 unless (seek FH, 0, 0)
330 0 0 if (not exists $Weather::Underground::MODULES{$module}) { }
0 0 elsif (not $Weather::Underground::MODULES{$module}) { }
354 0 0 if ($module eq 'Data::Dumper') { }
0 0 elsif ($module eq 'Storable') { }
0 0 elsif ($module eq 'FreezeThaw') { }
365 0 0 if (ref $cache ne 'HASH')
375 0 0 unless (open FH, ">$parameters{'cache_file'}")
418 0 2 if ($$self{'_cache_cache'})
424 0 0 if (exists $$self{'_cache_cache'}{$$self{'place'}})
425 0 0 if (time - $$self{'_cache_cache'}{$$self{'place'}}{'time'} <= $$self{'cache_max_age'}) { }
437 0 2 if ($$self{'timeout'})
446 0 2 if (not $document) { }
462 0 2 unless ($parser = 'HTML::TokeParser'->new(\$document))
467 1 1 if ($document =~ /observed at/i) { }
476 136 191 if ($$token[0] eq 'T' and not $$token[2]) { }
19 172 elsif ($state{'interesting'} and $$token[0] eq 'S' and uc $$token[1] eq 'TR') { }
36 136 elsif ($$token[0] eq 'S' and uc $$token[1] eq 'TD' and $state{'incontent'}) { }
1 135 elsif (not $state{'interesting'} and $$token[0] eq 'S' and uc $$token[1] eq 'TABLE' and $$token[2]{'border'} == 1) { }
1 221 elsif ($$token[0] eq 'E' and uc $$token[1] eq 'TABLE' and $state{'interesting'}) { }
487 80 56 unless $text =~ /[a-z0-9]/i
488 0 56 if $text eq 'IMG'
490 2 54 if ($state{'inheader'}) { }
51 3 elsif ($state{'incontent'}) { }
497 1 1 if ($text =~ /updated\s*:?\s*(.+?)\s*$/i)
501 1 1 if ($text =~ /observed\s+at\s+:?\s*(.+)/i)
512 18 33 if ($state{'contentnumber'} == 1) { }
528 15 18 if (exists $state{"content_$state{'lastcontentheader'}"})
542 1 18 if (not $state{'inheader'} || $state{'incontent'}) { }
1 17 elsif ($state{'inheader'}) { }
607 0 442 if ($$token[0] eq 'T' and not $$token[2] and $state{'interesting'}) { }
1 441 elsif (not $state{'interesting'} and $$token[0] eq 'S' and uc $$token[1] eq 'TABLE') { }
0 441 elsif ($state{'interesting'} and $$token[0] eq 'S' and uc $$token[1] eq 'TR') { }
0 441 elsif ($state{'incontent'} and $$token[0] eq 'E' and uc $$token[1] eq 'TR') { }
0 441 elsif ($state{'interesting'} and $$token[0] eq 'E' and uc $$token[1] eq 'TABLE') { }
615 0 0 unless $text =~ /[a-z0-9]/i
620 0 0 if ($state{'incontent'})
626 0 0 if (exists $state{'content'})
635 0 1 if ($state{'tablenumber'} == 2)
648 0 0 if (not $state{'inheader'} || $state{'incontent'}) { }
0 0 elsif ($state{'inheader'}) { }
681 1 1 if (not @$arrayref) { }
686 0 1 if ($$self{'cache_file'})
697 0 0 if (open FH, ">$$self{'cache_file'}") { }
698 0 0 if (flock FH, 2) { }
699 0 0 if (seek FH, 0, 0) { }
702 0 0 if ($$self{'_cache_module'} eq 'Data::Dumper') { }
0 0 elsif ($$self{'_cache_module'} eq 'Storable') { }
0 0 elsif ($$self{'_cache_module'} eq 'FreezeThaw') { }
739 0 146 if ($Weather::Underground::DEBUG)
758 0 15 unless exists $$stateref{$_}
764 0 1 if (not length $temperature_celsius and length $temperature_fahrenheit) { }
0 2 elsif (not length $temperature_fahrenheit and length $temperature_celsius) { }
774 0 1 if (not length $dewpoint_celsius and length $dewpoint_fahrenheit) { }
0 2 elsif (not length $dewpoint_fahrenheit and length $dewpoint_celsius) { }
784 0 1 if (not length $visibility_miles and length $visibility_kilometers) { }
0 2 elsif (not length $visibility_kilometers and length $visibility_miles) { }
797 0 1 if (not length $wind_milesperhour and length $wind_kilometersperhour) { }
0 2 elsif (not length $wind_kilometersperhour and length $wind_milesperhour) { }