Branch Coverage

blib/lib/WebFetch.pm
Criterion Covered Total %
branch 145 410 35.3


line true false branch
192 724 9 if (scalar @args == 0)
195 3 721 'WebFetch'->config('debug') ? :
199 4 5 $args[0] ? :
209 1 718 if ($debug_mode)
221 0 2 unless ($class->isa("WebFetch"))
224 2 0 if (exists $modules{$key})
238 0 2 unless eval "require $classname"
242 2 0 if $yaml_loaded
252 0 9 unless (defined $class)
255 0 9 unless ($class->isa("WebFetch"))
261 9 0 if (defined ${$class . "::VERSION";})
265 0 0 if (defined $WebFetch::VERSION)
275 0 746 unless ($class->isa("WebFetch"))
285 0 14 unless ($class->isa("WebFetch"))
295 0 4 unless ($class->isa("WebFetch"))
304 0 3 unless ($class->isa("WebFetch"))
318 0 2 unless ($class->isa("WebFetch"))
333 3 23 if (ref $capability eq "HASH")
340 20 3 if ($capability =~ /([^:]+):([^:]+)/x) { }
345 8 12 unless (exists $modules{$group})
348 17 3 unless (exists $modules{$group}{$subcap})
355 3 0 unless (exists $modules{$capability})
375 0 0 if ($capability =~ /([^:]*):(.*)/x) { }
386 0 0 if ($group) { }
391 0 0 if (exists $modules{$group}{$topic} and ref $modules{$group}{$topic} eq 'ARRAY') { }
0 0 elsif (exists $default_modules{$group}{$topic}) { }
396 0 0 unless (exists $handlers{$handler})
407 0 0 unless (exists $handlers{$def_handler})
417 0 0 if (exists $modules{$topic} and ref $modules{$topic} eq "ARRAY")
425 0 0 unless (@handlers or $is_optional)
446 0 0 if (ref $modules{$group}{$entry} eq "ARRAY")
449 0 0 if ($count > 1)
452 0 0 if ($entry_count == 1)
460 0 0 $count == 1 ? :
482 0 0 if (ref $ex) { }
483 0 0 if (my $ex_cap = "Exception::Class"->caught("WebFetch::Exception"))
484 0 0 if ($ex_cap->isa("WebFetch::TracedException"))
490 0 0 if ($ex->can('stringify')) { }
0 0 elsif ($ex->can('as_string')) { }
515 0 0 if (exists $modules{'cmdline'} and ref $modules{'cmdline'} eq "ARRAY")
527 0 0 if ('WebFetch'->has_config('Options')) { }
0 0 elsif (exists $symtab->{'Options'} and int @{$symtab->{'Options'};}) { }
536 0 0 if ('WebFetch'->has_config('Usage')) { }
0 0 elsif (exists $symtab->{'Usage'} and defined ${$$symtab{'Usage'};}) { }
571 0 0 unless ($options_result)
581 0 0 if (exists $options{'debug'} and $options{'debug'})
588 0 0 unless (exists $options{'source_format'})
589 0 0 if (my $fmt = singular_handler("input"))
593 0 0 unless (exists $options{'dest_format'})
594 0 0 if (my $fmt = singular_handler("output"))
601 0 0 if (exists $modules{'input'}{$options{'source_format'}} and ref $modules{'input'}{$options{'source_format'}} eq "ARRAY")
605 0 0 unless (exists $handlers{$handler})
611 0 0 if (exists $default_modules{$options{'source_format'}})
613 0 0 unless (exists $handlers{$handler})
620 0 0 unless (@handlers)
633 0 0 if (not @_)
639 0 0 if ($run_count == 0)
661 3 0 unless (exists $self->{'no_fetch'} and $self->{'no_fetch'})
663 0 3 if (exists $self->{'data'}) { }
664 0 0 unless $self->{'data'}->isa("WebFetch::Data::Store")
680 3 4 unless @args
696 6 31 if (exists $redirect_params{$key}) { }
703 4 2 if (not $self->{$hash_name}) { }
706 0 2 if (&reftype($self->{$hash_name}) ne "HASH")
729 0 3 unless eval "require $pkg"
747 2 1 exists $options_ref->{'test_probe'} && ref $options_ref->{'test_probe'} eq 'HASH' ? :
769 2 1 if ($test_probe_ref)
778 1 2 unless (exists $obj->{'actions'})
781 3 0 if (exists $obj->{'data'}) { }
782 3 0 if (exists $obj->{'dest'})
783 3 0 unless (exists $obj->{'actions'}{$dest_format})
797 3 0 $result ? :
798 2 1 if ($test_probe_ref)
803 0 3 unless ($result)
806 0 0 unless ref $savable eq "HASH"
807 0 0 if (exists $savable->{'error'})
811 0 0 if ($test_probe_ref)
814 0 0 if (@errors)
830 0 3 unless (exists $self->{'data'} and exists $self->{'actions'})
840 7 0 if (exists $modules{'output'}{$action_spec})
842 7 0 if (my $func_ref = $class->can($action_handler))
849 7 0 if (defined $handler_ref) { }
855 0 7 if (ref $entry ne "ARRAY")
894 0 0 unless (defined $source)
906 0 0 if ($response->is_error)
928 0 0 if (not ref $fields or ref $fields ne "ARRAY")
931 0 0 if (not ref $lines or ref $lines ne "ARRAY")
934 0 0 if (defined $param and ref $param ne "HASH")
943 0 0 if (defined $comment)
956 0 0 unless defined $item
972 8 0 exists $self->{'style'}{'para'} ? :
973 0 4 exists $self->{'style'}{'notable'} ? :
974 0 14 exists $self->{'style'}{'ul'} ? :
982 0 0 unless exists $self->{'style'}{'para'} or exists $self->{'style'}{'ul'} or exists $self->{'style'}{'bullet'}
983 0 10 exists $self->{'style'}{'bullet'} ? :
990 8 8 if (exists $params{'_close'})
991 8 0 $params{'_close'} ? :
994 0 16 exists $self->{'css_class'} ? :
997 8 8 $close_tag ? :
1011 2 0 unless ($self->_style_notable)
1017 0 2 if ($self->_style_ul)
1021 2 0 if (@$links >= 0) { }
1023 0 10 $self->_style_bullet ? :
0 10 $self->_style_ul ? :
1029 2 8 if (++$link_count >= $self->{'num_links'})
1032 0 8 if (exists $self->{'table_sections'} and not $self->_style_para and not $self->_style_notable and $link_count == int(($self->{'num_links'} + 1) / $self->{'table_sections'})) { }
1042 8 0 if ($self->_style_para) { }
0 0 elsif ($self->_style_bullet) { }
1056 0 2 if ($self->_style_ul)
1059 2 0 unless ($self->_style_notable)
1075 0 2 if (defined $self->{'font_size'} or defined $self->{'font_face'})
1079 0 0 defined $self->{'font_size'} ? :
0 0 defined $self->{'font_face'} ? :
1089 0 2 if (defined $self->{'font_size'} or defined $self->{'font_face'})
1120 1 4 unless (exists $self->{'savable'})
1129 0 5 exists $self->{'group'} ? :
0 5 exists $self->{'mode'} ? :
1139 0 0 unless (exists $self->{'savable'})
1152 0 0 exists $self->{'group'} ? :
0 0 exists $self->{'mode'} ? :
1178 0 3 unless (exists $self->{'dir'})
1181 0 3 unless (exists $self->{'savable'})
1184 0 3 if (ref $self->{'savable'} ne "ARRAY")
1197 0 0 if (exists $self->{'fetch_urls'} and $self->{'fetch_urls'})
1202 0 0 if (defined $url)
1219 0 1 unless (open $new_file, ">:encoding(UTF-8)", "$new_content")
1223 0 1 unless (print $new_file $savable->{'content'})
1228 0 1 unless (close $new_file)
1244 0 1 if (-f $main_content)
1245 0 0 unless (rename $main_content, $old_content)
1260 0 1 if (exists $savable->{'group'})
1262 0 0 unless ($gid =~ /^[0-9]+$/ox)
1264 0 0 unless (defined $gid)
1269 0 0 unless (chown $>, $gid, $new_content)
1276 0 1 if (exists $savable->{'mode'})
1277 0 0 unless (chmod oct $savable->{'mode'}, $new_content)
1298 0 0 unless eval "require $db_class"
1303 0 0 if ($db_available and exists $savable->{'url'} and exists $savable->{'index'})
1306 0 0 if (exists $id_index{$savable->{'url'}}) { }
1334 0 0 if ($yaml_loaded and exists $savable->{'url'} and exists $savable->{'index'})
1339 0 0 if (-f $index_lock_path and pshlock($index_lock_path))
1344 0 0 if (exists $$id_index_ref{$savable->{'url'}}) { }
1355 0 0 if (not $was_in_index and pexclock($index_lock_path))
1376 0 1 if (-f $index_db_path and not -f $index_yaml_path)
1385 0 1 $was_in_index ? :
1395 0 0 if (not exists $savable->{'content'} and exists $savable->{'url'})
1414 0 7 if (exists $savable->{'error'})
1419 0 3 if ($err_count)
1441 1 2 if (exists $savable->{'file'})
1446 2 1 if exists $savable->{'ok_empty'}
1449 0 1 unless (exists $savable->{'file'})
1453 0 0 unless (exists $savable->{'content'} or exists $savable->{'url'})
1466 0 1 if (-f $new_content)
1467 0 0 unless (unlink $new_content)
1474 0 1 unless ($self->_save_check_index($savable))
1481 0 1 unless ($self->_save_fill_empty_from_url($savable))
1488 0 1 unless ($self->_save_write_content($savable, $new_content))
1495 0 1 if (-f $old_content)
1496 0 0 unless (unlink $old_content)
1503 0 1 unless ($self->_save_main_to_backup($savable, $main_content), $old_content)
1510 0 1 unless ($self->_save_file_mode($savable, $new_content))
1517 1 0 if (-f $new_content)
1518 0 1 unless (rename $new_content, $main_content)
1536 33 46 if (ref $args[0] eq "HASH")
1546 6 73 if ($stamp =~ /^ (\d{4}) - (\d{2}) - (\d{2}) \s* $/x) { }
0 73 elsif ($stamp =~ /^ (\d{4}) (\d{2}) (\d{2}) \s* $/x) { }
1558 73 6 unless (defined $result)
1561 0 23 if (exists $opts{'time_zone'} and $result->time_zone eq "floating")
1571 50 29 unless (defined $result)
1576 0 50 if (@date)
1590 8 0 if (ref $args[0] eq "HASH")
1596 8 0 if (ref $args[0])
1597 8 0 if (ref $args[0] eq 'DateTime') { }
0 0 elsif (ref $args[0] eq 'ARRAY') { }
1599 8 0 if (exists $opts{'locale'})
1604 8 0 if (exists $opts{'time_zone'})
1614 0 0 unless (exists $dt_opts{$key})
1625 0 8 if ($date_only)
1635 21 0 if (ref $args[0] eq "HASH")
1641 21 0 if (ref $args[0])
1642 17 4 if (ref $args[0] eq 'DateTime') { }
4 0 elsif (ref $args[0] eq 'ARRAY') { }
1644 8 9 if (exists $opts{'time_zone'})
1654 0 0 unless (exists $dt_opts{$key})
1664 0 21 unless defined $datetime
1665 4 17 if ($date_only)
1698 2 0 if (defined $params->{'filter_func'} or defined $params->{'sort_func'})
1703 2 0 if (defined $params->{'filter_func'} and ref $params->{'filter_func'} eq 'CODE') { }
1710 33 0 if (&{$params->{'filter_func'};}(@{$$self{"data"}{"records"}[$i];}))
1722 2 0 if (defined $params->{'sort_func'} and ref $params->{'sort_func'} eq "CODE")
1729 2 0 if (defined $params->{'format_func'} and ref $params->{'format_func'} eq "CODE")
1755 0 0 defined $url_fnum ? :
0 0 defined $url_fnum ? :
0 0 defined $summary_fnum ? :
0 0 defined $title_fnum ? :
0 0 defined $comments_fnum ? :
1854 0 0 unless (defined $title_fnum and defined $url_fnum)
1855 0 0 !defined($title_fnum) ? :
0 0 !defined($url_fnum) ? :
1861 0 0 unless (defined $self->{'savable'})
1870 0 0 if ($title_fnum == 0 and $url_fnum == 1) { }
1892 0 5 unless my $type = ref $self
1899 5 0 if $name =~ /^[A-Z]+$/x
1904 0 0 unless ($package->can($name))
1921 0 0 ref $e ? :