Branch Coverage

blib/lib/App/RSS2Leafnode.pm
Criterion Covered Total %
branch 0 728 0.0


line true false branch
200 0 0 unless ($str =~ /\n$/)
220 0 0 is_non_empty($str) ? :
230 0 0 unless defined $str
231 0 0 $1 eq ' ' ? :
291 0 0 if ($length >= 2000) { }
346 0 0 unless Getopt::Long::GetOptions('config=s', \$$self{'config_filename'}, 'verbose:1', \$$self{'verbose'}, 'version', sub { say __x('RSS2Leafnode version {version}', 'version', $VERSION); $done_version = 1; } , 'bareversion', sub { say $VERSION; $done_version = 1; } , 'msgid=s', \$$self{'msgidextra'}, 'help|?', sub { say __x('rss2leafnode [--options]'); say __x(' --config=filename configuration file (default ~/.rss2leafnode.conf)'); say __x(' --help print this help'); say __x(q[ --verbose describe what's done]); say __x(q[ --verbose=2 show technical details of what's done]); say __x(' --version print program version number'); exit 0; } )
347 0 0 unless ($done_version)
357 0 0 if ($$self{'verbose'} >= $count)
381 0 0 unless open STDERR, '>&STDOUT'
386 0 0 if ($$self{'verbose'} >= 2)
396 0 0 if (not defined do { package App::RSS2Leafnode::Conf; do $config_filename })
399 0 0 if (not -e $config_filename) { }
412 0 0 if (defined $$self{'user_agent'}) { }
458 0 0 unless $self
468 0 0 if ($got ne $want) { }
487 0 0 if ($$self{'html_charset_from_content'} and $resp->headers->content_is_html)
647 0 0 unless (defined $isodate)
650 0 0 if ($isodate =~ /\dT\d/ or $isodate =~ /^\d{4}-\d{2}-\d{2}$/)
654 0 0 $isodate =~ s/Z$// ? :
0 0 $isodate =~ s/([+-][0-9][0-9]):([0-9][0-9])$// ? :
659 0 0 if (defined $time_t)
692 0 0 if defined $date
756 0 0 if (my $uri = eval { do { 'URI'->new($url) } })
758 0 0 if ($uri->can('host')) { }
0 0 elsif ($uri->can('authority')) { }
770 0 0 if (is_empty($host) or $host eq 'localhost')
786 0 0 if (is_empty($host) or $host eq 'localhost')
793 0 0 if ($host =~ s/^\[|\]$//g | $host =~ tr/:/./)
798 0 0 unless ($host =~ /\./)
848 0 0 if (not $$self{'nntp'} or $$self{'nntp'}->host ne $$self{'nntp_host'})
853 0 0 $$self{'verbose'} >= 2 ? :
857 0 0 unless ($nntp)
860 0 0 unless ($nntp->postok)
869 0 0 if (my $nntp = delete $$self{'nntp'})
870 0 0 if (not $nntp->quit)
880 0 0 unless ($nntp->group($group))
895 0 0 if ($$self{'verbose'} >= 2) { }
0 0 elsif ($$self{'verbose'} >= 1) { }
896 0 0 $ret ? :
898 0 0 if ($ret)
909 0 0 unless ($nntp->post($msg->as_string))
927 0 0 unless defined $resp
928 0 0 unless (exists $resp_exiftool_info{$resp})
947 0 0 unless eval { do { require Image::ExifTool; 1 } }
969 0 0 unless eval { do { require URI::Title } }
974 0 0 unless $msg =~ /Use of uninitialized value/
983 0 0 unless $resp->content_type =~ m[^image/]
984 0 0 if (defined(my $title = html_title_exiftool($resp)))
989 0 0 unless defined $$info{'ImageSize'}
1009 0 0 unless my $IO = $body->open('w')
1012 0 0 unless $IO->close
1019 0 0 if (defined $str and not is_ascii($str))
1042 0 0 if ($$headers{'Top'})
1048 0 0 if (utf8::is_utf8($$headers{'Data'}))
1053 0 0 if ($$headers{'Type'} eq 'text/plain' and lc($$headers{'Charset'} || 0) eq 'utf-8' and is_ascii($$headers{'Data'}))
1067 0 0 if ($$self{'verbose'} >= 4)
1075 0 0 if ($$headers{'Top'} and not defined $$headers{'X-Mailer:'})
1102 0 0 if ($rendered)
1148 0 0 unless defined $elt
1149 0 0 if ($elt->is_text)
1154 0 0 unless defined $elt
1155 0 0 if ($elt->is_text)
1180 0 0 if ($attname =~ /^(xhtml|atom):(.*)/)
1209 0 0 unless (defined $elt)
1211 0 0 if (defined(my $type = $elt->att('atom:type') // $elt->att('type')))
1214 0 0 if ($type eq 'application/xhtml+xml')
1217 0 0 if ($elt->root->tag eq 'feed')
1221 0 0 if ($tag =~ /^itunes:/)
1225 0 0 if ($tag eq 'description' or $tag eq 'content:encoded')
1239 0 0 unless defined $elt
1243 0 0 if ($type eq 'xhtml') { }
1249 0 0 if ($type eq 'html')
1271 0 0 unless defined $twig
1275 0 0 if (my $ttl = $root->first_descendant('ttl'))
1278 0 0 if (my $skipHours = $root->first_descendant('skipHours'))
1281 0 0 if (my $skipDays = $root->first_descendant('skipDays'))
1287 0 0 if (my $update = $root->first_descendant("syn:$key"))
1291 0 0 if ($$self{'verbose'} >= 2)
1297 0 0 unless (%timingfields)
1302 0 0 unless $self->timingfields_to_timing(\%timingfields)
1320 0 0 unless eval { do { require XML::RSS::Timing } }
1324 0 0 if (ref $value) { }
1330 0 0 if (my(@complaints) = $timing->complaints)
1359 0 0 unless (defined $global_status)
1360 0 0 if ($! == 2) { }
1378 0 0 if ($$global_status{$key}{'status-time'} < $old_time)
1384 0 0 if ($pruned)
1396 0 0 if ($$status{'timingfields'})
1421 0 0 unless open $out, '>', $status_filename and print $out $str and close $out
1431 0 0 unless $$self{'global_status'}
1432 0 0 unless ($$self{'global_status'}{$url})
1444 0 0 if ($resp and $resp->is_success)
1450 0 0 unless (defined $$status{'ETag'} or defined $$status{'Last-Modified'})
1453 0 0 if (defined(my $comments_count = $$self{'comments_count'}))
1457 0 0 if ($twig)
1466 0 0 unless (defined $$status{$key})
1486 0 0 unless $$self{'global_status'}
1495 0 0 if ($for_rss)
1498 0 0 unless (str_equal($$self{'rss_newest_only'}, $$status{'rss_newest_only'}))
1504 0 0 if (my $timing = $self->timingfields_to_timing($$status{'timingfields'}))
1507 0 0 if ($next > $now)
1512 0 0 if (eval 'use Time::Duration::Locale; 1' or eval 'use Time::Duration; 1')
1520 0 0 if (defined(my $lastmod = $$status{'Last-Modified'}))
1523 0 0 if (defined(my $etag = $$status{'ETag'}))
1564 0 0 if ($$self{'render'} and $content_type eq 'text/html')
1567 0 0 unless ($class =~ /^HTML::/)
1572 0 0 if ($class =~ /^HTML::FormatText($|::WithLinks)/) { }
1606 0 0 unless $msg =~ /^Unknown configure option 'base'/
1613 0 0 unless (defined $prefix)
1619 0 0 length $prefix ? :
1630 0 0 unless $$self{'get_icon'}
1631 0 0 unless my($uri, $width, $height) = $self->item_image_uwh($item)
1633 0 0 unless $self->face_wh_ok($width, $height)
1649 0 0 if (my $actor = $where->first_child('activity:actor'))
1652 0 0 unless ($link_elt->att('rel') || $link_elt->att('atom:rel') || '') eq 'avatar'
1656 0 0 if defined $width and defined $this_width and $width < $this_width
1666 0 0 if (defined $url)
1677 0 0 if (my $image_elt = $where->first_child('image'))
1680 0 0 if ($url_elt = $image_elt->first_child('url')) { }
1690 0 0 if ($image_elt->text =~ /]*\ssrc="([^"]*)/)
1696 0 0 if (is_non_empty($url))
1698 0 0 unless (&Scalar::Util::looks_like_number($width) and $width > 0)
1702 0 0 unless (&Scalar::Util::looks_like_number($height) and $height > 0)
1743 0 0 if ($url)
1744 0 0 unless (&Scalar::Util::looks_like_number($width) and $width > 0)
1747 0 0 unless (&Scalar::Util::looks_like_number($height) and $height > 0)
1758 0 0 if (my $elt = $where->first_child('statusnet:postIcon'))
1759 0 0 if (is_non_empty(my $url = $elt->att('rdf:resource')))
1770 0 0 if ($elt = $where->first_child('author') and $elt = $elt->first_child('gd:image') and is_non_empty(my $url = $elt->att('src') // $elt->att('atom:src')))
1803 0 0 unless $$self{'get_icon'}
1817 0 0 unless $resp->headers->content_is_html
1824 0 0 if ($tagname eq 'link' and $$attr{'rel'} eq 'icon')
1840 0 0 unless (exists $$self{'download_face'}{$key})
1855 0 0 unless ($resp->is_success)
1866 0 0 if ($type eq 'image/vnd.microsoft.icon' or $type eq 'image/x-icon') { }
0 0 elsif ($type =~ m[^image/(.*)$]i) { }
1879 0 0 if ($type ne 'png' or $width == 0 or $height == 0 or $width > 48 or $height > 48)
1899 0 0 if ($width > 0 and $width > 2 * $height)
1923 0 0 if ($width == 0 or $height == 0)
1926 0 0 if ($width <= 48 and $height <= 48 and $type eq 'png')
1935 0 0 if ($width > 48 or $height > 48)
1937 0 0 if ($width <= 96 and $height <= 96) { }
1952 0 0 if ($ret != 0)
1969 0 0 unless eval { do { require Image::Magick } }
1976 0 0 if ($ret == 1)
1986 0 0 if ($ret == 1)
2003 0 0 if (eval { do { require XML::Liberal; 1 } })
2014 0 0 unless $self->have_xml_liberal
2018 0 0 if (my $doc = eval { do { $liberal->parse_string($xmlstr) } }) { }
2058 0 0 if (defined $attach_bytes)
2069 0 0 unless $self->nntp_post($top)
2095 0 0 unless ($resp->content_type =~ m[^text/])
2109 0 0 if ($resp->headers->content_is_html)
2118 0 0 if ($tagname eq 'meta' and lc($$attr{'property'} || '') eq 'og:type')
2143 0 0 unless $self->nntp_group_check($group)
2149 0 0 if ($resp->code == 304)
2153 0 0 unless ($resp->is_success)
2171 0 0 if $self->nntp_message_id_exists($msgid)
2198 0 0 if ($part)
2205 0 0 unless $self->nntp_post($top)
2217 0 0 unless $$self{'html_extract_main'}
2218 0 0 unless $resp->headers->content_is_html
2236 0 0 unless (defined $content)
2268 0 0 unless $url =~ m[^http://[^/]*yahoo\.com/.*\*(http://.*yahoo\.com.*)$]
2282 0 0 if ($$l{'uri'} and $$l{'uri'}->canonical =~ m[^http://groups\.google\.com/group/([^/]+)/])
2313 0 0 if ($resp->is_success)
2316 0 0 if ($content =~ /]*Refresh[^>]*checkForCookies/i)
2417 0 0 if ($$self{'verbose'} >= 2)
2425 0 0 if ($tag eq 'content' and atom_content_flavour($elt) ne 'link')
2435 0 0 if (defined $rel) { }
2439 0 0 if ($rel eq 'self' or $rel eq 'edit' or $rel eq 'service.edit' or $rel eq 'license')
2447 0 0 if ($rel eq 'alternate') { }
0 0 elsif ($rel eq 'enclosure') { }
0 0 elsif ($rel eq 'ostatus:conversation') { }
0 0 elsif ($rel eq 'ostatus:attention') { }
0 0 elsif ($rel eq 'related') { }
0 0 elsif ($rel eq 'replies') { }
0 0 elsif ($rel eq 'service.post') { }
0 0 elsif ($rel eq 'via') { }
2470 0 0 if ($self->atom_link_is_rss($elt)) { }
2471 0 0 defined $count ? :
2476 0 0 defined $count ? :
2497 0 0 if ($tag eq 'enclosure') { }
0 0 elsif ($tag eq 'dc:source') { }
0 0 elsif ($tag eq 'wiki:diff') { }
0 0 elsif ($tag eq 'wiki:history') { }
0 0 elsif ($tag =~ /foaf:maker|sioc:has_creator/) { }
0 0 elsif ($tag eq 'statusnet:origin') { }
0 0 elsif ($tag eq 'sioc:has_discussion') { }
0 0 elsif ($tag eq 'wfw:commentrss') { }
0 0 elsif ($tag =~ /comment/) { }
2529 0 0 if (defined(my $count = $self->item_elt_comments_count($item, $elt))) { }
2538 0 0 if (defined(my $count = $self->item_elt_comments_count($item, $elt))) { }
2557 0 0 if (defined $$l{'ur'})
2562 0 0 if ($$l{'maybe_text'} and not $$l{'uri'} =~ m[^[a-z]+://]) { }
2573 0 0 if (defined(my $length = $elt->att('atom:length') // $elt->att('length')))
2579 0 0 if ($tag eq 'enclosure' and defined(my $duration = non_empty($item->first_child_text('itunes:duration'))))
2581 0 0 unless ($duration =~ /:/)
2587 0 0 if (@paren)
2595 0 0 if (not $item->first_child('prism:url') and my $elt = $item->first_child('prism:doi'))
2616 0 0 if (defined $str)
2627 0 0 if (defined $subelt and defined(my $url = (non_empty($subelt->att('url')) // non_empty($subelt->att('href'))) // non_empty($subelt->att('atom:href'))))
2653 0 0 if (my $uri = $$l{'uri'})
2656 0 0 if (my $prev_l = $seen{$canonical})
2663 0 0 if (is_empty($$l{'uri'}->fragment))
2667 0 0 if ($$prev_l{'name'} eq __('Link')) { }
0 0 elsif ($$l{'name'} eq __('Link')) { }
0 0 elsif ($$l{'name'} eq $$prev_l{'name'}) { }
2684 0 0 if ($$l{'uri'})
2689 0 0 if (my $elt = $item->first_child('hlxcd:helex-company-data'))
2696 0 0 if (is_non_empty($str))
2704 0 0 if (defined(my $str = $self->item_to_lat_long_alt_str($item)))
2716 0 0 defined $label ? :
2833 0 0 unless my($lat, $long, $alt) = $self->item_to_lat_long_alt_values($item)
2839 0 0 if (&Scalar::Util::looks_like_number($lat))
2840 0 0 $lat >= 0 ? :
2847 0 0 if (&Scalar::Util::looks_like_number($long))
2848 0 0 $long >= 0 ? :
2853 0 0 if (is_non_empty($alt)) { }
2895 0 0 if (is_non_empty($lat))
2907 0 0 if (is_non_empty($str))
2916 0 0 if (my $elt = $item->first_child('statusnet:origin'))
2917 0 0 if (defined(my $lat = $elt->att('geo:lat')))
2937 0 0 unless @_
2950 0 0 if (defined(my $uri = $$l{'uri'}))
2952 0 0 if (defined(my $hreflang = $$l{'hreflang'}))
2955 0 0 if (defined(my $type = $$l{'type'}))
3039 0 0 if (my(@elts) = $item->children($tag))
3045 0 0 if (my $uri = (non_empty($elt->first_child_text('uri')) // non_empty($elt->att('url'))) // non_empty(do { my $child; $child->att('link') // $child->att('rss:link') if $child = $elt->first_child('rdf:Description') }))
3065 0 0 if $child = $elt->first_child('rdf:Description')
3077 0 0 if @from
3079 0 0 unless (@from)
3085 0 0 unless (@from)
3139 0 0 unless defined $elt
3155 0 0 if $rdfdesc = $elt->first_child('rdf:Description')
3193 0 0 if (is_empty($email))
3196 0 0 if (/^\s*(mailto:)?($mailbox_with_comment_re)\s*$/o) { }
0 0 elsif (/(.*)\((mailto:)?($mailbox_re)\)\s*$/o or /(.*)<(mailto:)?($mailbox_re)>\s*$/o) { }
3221 0 0 if (is_empty($email) and $display =~ /^$mailbox_re$/o) { }
3244 0 0 if (is_empty($display))
3245 0 0 if (is_empty($email)) { }
3251 0 0 if (is_empty($email)) { }
3266 0 0 unless defined $str
3269 0 0 if ($str =~ m[[^[:alnum:][:space:]!#\$%&'*+/=?^_`{|}~-]]) { }
3279 0 0 unless defined $str
3301 0 0 if (defined(my $str = $$self{'rss_newest_only'}))
3302 0 0 if ($str =~ /^\s*(\d+)\s*(minute|hour|day|week|month|year)s?\s*$/)
3313 0 0 if (defined(my $str = $$self{'rss_newest_only'}))
3314 0 0 if (&Scalar::Util::looks_like_number($str))
3326 0 0 if (defined(my $count = $self->rss_newest_only_count))
3327 0 0 if ($count == 0)
3337 0 0 if ($before != $after)
3343 0 0 if (defined(my $target_timet = $self->rss_newest_only_timet))
3346 0 0 unless not defined $got_timet
3349 0 0 if ($before != $after)
3355 0 0 if (defined(my $str = $$self{'rss_newest_only'}))
3455 0 0 if ($err and $err =~ /not well-formed \(invalid token\) at (line \d+, column \d+, byte (\d+))/)
3458 0 0 if ($byte >= 128)
3466 0 0 if ($twig->safe_parse($recoded_xml))
3480 0 0 if ($err)
3482 0 0 if (defined $liberal_xml)
3485 0 0 if ($twig->safe_parse($liberal_xml))
3500 0 0 if ($err)
3530 0 0 if (defined $$self{'uri'} and not $root->att_exists('xml:base'))
3551 0 0 if (is_non_empty(my $id = $item->first_child_text('id')))
3558 0 0 if (my $elt = $item->first_child('guid'))
3561 0 0 if (is_non_empty(my $str = collapse_whitespace($elt->text)))
3567 0 0 if ($isPermaLink)
3570 0 0 if (my $link = item_yahoo_permalink($item))
3573 0 0 if (defined $guid)
3626 0 0 if (@ids) { }
3731 0 0 if ($cap_severity)
3736 0 0 if ($cap_severity_high{$cap_severity})
3739 0 0 if ($cap_severity_normal{$cap_severity})
3742 0 0 if ($cap_severity_low{$cap_severity} or $wiki_importance eq 'minor')
3771 0 0 if ($cap_severity_urgent{$cap_severity})
3774 0 0 if ($cap_severity_normal{$cap_severity})
3859 0 0 if (my $elt = $item->first_child('content'))
3917 0 0 if ((($link->att('atom:rel') // $link->att('rel')) // '') eq 'license')
3946 0 0 if (my $generator = $channel->first_child('generator'))
3960 0 0 if (my $notice = $item->first_child('statusnet:notice_info'))
3961 0 0 if (defined(my $html = $notice->att('atom:source')))
3985 0 0 unless (defined $elt)
3987 0 0 if ($elt->att('atom:src') or $elt->att('src'))
3991 0 0 if (not defined $type or $type eq 'html' or $type eq 'xhtml' or $type eq 'application/xhtml+xml' or $type =~ m[^text/])
4003 0 0 is_ascii($fragment) ? :
4005 0 0 defined $base_uri ? :
4008 0 0 if (is_non_empty($language)) { }
4035 0 0 if (my $charset = $$self{'rss_charset_override'})
4037 0 0 if ($xml =~ s/(<\?xml[^>]*encoding="?)([^">]+)/$1$charset/i) { }
0 0 elsif ($xml =~ s/(<\?xml[^?>]*)/$1 encoding="$charset"/i) { }
4060 0 0 if ($field eq 'geocode' or $field eq 'parameter')
4068 0 0 if (is_non_empty($value))
4072 0 0 unless (@fields)
4083 0 0 if ($want_html) { }
4099 0 0 $_->tag eq 'media:group' ? :
4102 0 0 if $elt->tag =~ /^#/
4103 0 0 if App::RSS2Leafnode::XML::Twig::Other::elt_is_empty($elt)
4108 0 0 if $path =~ m[/xhtml]
4109 0 0 if $path =~ m[^/channel/item/(description|content:encoded)/]
4110 0 0 if exists $known{$path}
4124 0 0 if ($xml eq '')
4129 0 0 if ($want_html) { }
4164 0 0 if (defined(my $role = non_empty($elt->att('role'))))
4177 0 0 if (defined(my $type = non_empty($elt->att('type'))))
4180 0 0 if (defined(my $lang = non_empty($elt->att('lang'))))
4186 0 0 if (defined(my $size = non_empty($elt->att('fileSize'))))
4189 0 0 if (defined(my $duration = non_empty($elt->att('duration'))))
4190 0 0 unless ($duration =~ /:/)
4196 0 0 if (@paren)
4214 0 0 unless defined $elt
4217 0 0 if ($type eq 'xhtml')
4221 0 0 if ($type eq 'html') { }
4246 0 0 unless ($self->nntp_message_id_exists($msgid))
4266 0 0 if (defined $$self{'getting_rss_comments'})
4271 0 0 defined $list_post ? :
4341 0 0 if (not defined $body_type) { }
0 0 elsif ($body_type eq 'xhtml') { }
0 0 elsif ($body_type eq 'html') { }
0 0 elsif ($body_type eq 'text') { }
0 0 elsif ($body_type =~ m[^text/]) { }
4370 0 0 $links_want_html ? :
4375 0 0 unless ($$b{'download'} || 0) <=> ($$a{'download'} || 0)
4378 0 0 $links_want_html ? :
4389 0 0 if (is_non_empty($content))
4396 0 0 if ($content_type eq 'text/plain') { }
4408 0 0 if (is_non_empty(my $content = $self->item_unknowns($item, $links_want_html)))
4410 0 0 $links_want_html ? :
4411 0 0 if (@parts) { }
4412 0 0 is_ascii($content) ? :
4423 0 0 if ($$self{'rss_get_links'})
4425 0 0 unless $$l{'download'}
4435 0 0 unless ($resp->is_success)
4442 0 0 if ($links_want_html) { }
4462 0 0 if ($links_want_html and $body_type eq 'html')
4468 0 0 if ($body_type eq 'html')
4472 0 0 if (defined $body_charset)
4479 0 0 if ($body_type eq 'text/plain')
4484 0 0 unless ($links_want_html)
4486 0 0 unless (is_empty($links_str))
4494 0 0 unless (is_empty($links_str))
4497 0 0 if ($links_want_html) { }
4502 0 0 is_ascii($links_str) ? :
4519 0 0 if ($attach_elt)
4537 0 0 unless $self->nntp_post($top)
4543 0 0 if ($$self{'rss_get_comments'})
4547 0 0 if (defined $comments_rss_url)
4552 0 0 if (defined $$status{'comments_count'} and defined $comments_count and $$status{'comments_count'} == $comments_count) { }
4582 0 0 unless $rel eq 'replies'
4583 0 0 unless $self->atom_link_is_rss($elt)
4586 0 0 if (is_non_empty($href))
4594 0 0 unless (defined $url)
4596 0 0 if (is_non_empty($u))
4630 0 0 unless $self->nntp_group_check($group)
4637 0 0 if (defined $$self{'getting_rss_comments'}) { }
4644 0 0 unless $self->status_etagmod_req($req, 1)
4650 0 0 if ($resp->code == 304)
4654 0 0 unless ($resp->is_success)
4664 0 0 unless $resp->decode
4672 0 0 if (defined $err)
4675 0 0 if ($resp->request->uri ne $url)
4687 0 0 if ($$self{'verbose'} >= 3)
4704 0 0 if ($$self{'verbose'} >= 2)
4706 0 0 if ($jar and my $str = $jar->as_string ne '') { }