Branch Coverage

blib/lib/App/RSS2Leafnode.pm
Criterion Covered Total %
branch 0 718 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)
690 0 0 if defined $date
754 0 0 if (my $uri = eval { do { 'URI'->new($url) } })
756 0 0 if ($uri->can('host')) { }
0 0 elsif ($uri->can('authority')) { }
768 0 0 if (is_empty($host) or $host eq 'localhost')
784 0 0 if (is_empty($host) or $host eq 'localhost')
791 0 0 if ($host =~ s/^\[|\]$//g | $host =~ tr/:/./)
796 0 0 unless ($host =~ /\./)
846 0 0 if (not $$self{'nntp'} or $$self{'nntp'}->host ne $$self{'nntp_host'})
851 0 0 $$self{'verbose'} >= 2 ? :
855 0 0 unless ($nntp)
858 0 0 unless ($nntp->postok)
867 0 0 if (my $nntp = delete $$self{'nntp'})
868 0 0 if (not $nntp->quit)
878 0 0 unless ($nntp->group($group))
893 0 0 if ($$self{'verbose'} >= 2) { }
0 0 elsif ($$self{'verbose'} >= 1) { }
894 0 0 $ret ? :
896 0 0 if ($ret)
907 0 0 unless ($nntp->post($msg->as_string))
925 0 0 unless defined $resp
926 0 0 unless (exists $resp_exiftool_info{$resp})
945 0 0 unless eval { do { require Image::ExifTool; 1 } }
967 0 0 unless eval { do { require URI::Title } }
972 0 0 unless $msg =~ /Use of uninitialized value/
981 0 0 unless $resp->content_type =~ m[^image/]
982 0 0 if (defined(my $title = html_title_exiftool($resp)))
987 0 0 unless defined $$info{'ImageSize'}
1007 0 0 unless my $IO = $body->open('w')
1010 0 0 unless $IO->close
1017 0 0 if (defined $str and not is_ascii($str))
1040 0 0 if ($$headers{'Top'})
1046 0 0 if (utf8::is_utf8($$headers{'Data'}))
1051 0 0 if ($$headers{'Type'} eq 'text/plain' and lc($$headers{'Charset'} || 0) eq 'utf-8' and is_ascii($$headers{'Data'}))
1065 0 0 if ($$self{'verbose'} >= 4)
1073 0 0 if ($$headers{'Top'} and not defined $$headers{'X-Mailer:'})
1100 0 0 if ($rendered)
1146 0 0 unless defined $elt
1147 0 0 if ($elt->is_text)
1152 0 0 unless defined $elt
1153 0 0 if ($elt->is_text)
1178 0 0 if ($attname =~ /^(xhtml|atom):(.*)/)
1207 0 0 unless (defined $elt)
1209 0 0 if (defined(my $type = $elt->att('atom:type') // $elt->att('type')))
1212 0 0 if ($type eq 'application/xhtml+xml')
1215 0 0 if ($elt->root->tag eq 'feed')
1219 0 0 if ($tag =~ /^itunes:/)
1223 0 0 if ($tag eq 'description' or $tag eq 'content:encoded')
1237 0 0 unless defined $elt
1241 0 0 if ($type eq 'xhtml') { }
1247 0 0 if ($type eq 'html')
1269 0 0 unless defined $twig
1273 0 0 if (my $ttl = $root->first_descendant('ttl'))
1276 0 0 if (my $skipHours = $root->first_descendant('skipHours'))
1279 0 0 if (my $skipDays = $root->first_descendant('skipDays'))
1285 0 0 if (my $update = $root->first_descendant("syn:$key"))
1289 0 0 if ($$self{'verbose'} >= 2)
1295 0 0 unless (%timingfields)
1300 0 0 unless $self->timingfields_to_timing(\%timingfields)
1318 0 0 unless eval { do { require XML::RSS::Timing } }
1322 0 0 if (ref $value) { }
1328 0 0 if (my(@complaints) = $timing->complaints)
1357 0 0 unless (defined $global_status)
1358 0 0 if ($! == 2) { }
1376 0 0 if ($$global_status{$key}{'status-time'} < $old_time)
1382 0 0 if ($pruned)
1394 0 0 if ($$status{'timingfields'})
1419 0 0 unless open $out, '>', $status_filename and print $out $str and close $out
1429 0 0 unless $$self{'global_status'}
1430 0 0 unless ($$self{'global_status'}{$url})
1442 0 0 if ($resp and $resp->is_success)
1448 0 0 unless (defined $$status{'ETag'} or defined $$status{'Last-Modified'})
1451 0 0 if (defined(my $comments_count = $$self{'comments_count'}))
1455 0 0 if ($twig)
1464 0 0 unless (defined $$status{$key})
1484 0 0 unless $$self{'global_status'}
1493 0 0 if ($for_rss)
1496 0 0 unless (str_equal($$self{'rss_newest_only'}, $$status{'rss_newest_only'}))
1502 0 0 if (my $timing = $self->timingfields_to_timing($$status{'timingfields'}))
1505 0 0 if ($next > $now)
1510 0 0 if (eval 'use Time::Duration::Locale; 1' or eval 'use Time::Duration; 1')
1518 0 0 if (defined(my $lastmod = $$status{'Last-Modified'}))
1521 0 0 if (defined(my $etag = $$status{'ETag'}))
1562 0 0 if ($$self{'render'} and $content_type eq 'text/html')
1565 0 0 unless ($class =~ /^HTML::/)
1570 0 0 if ($class =~ /^HTML::FormatText($|::WithLinks)/) { }
1604 0 0 unless $msg =~ /^Unknown configure option 'base'/
1611 0 0 unless (defined $prefix)
1617 0 0 length $prefix ? :
1628 0 0 unless $$self{'get_icon'}
1629 0 0 unless my($uri, $width, $height) = $self->item_image_uwh($item)
1631 0 0 unless $self->face_wh_ok($width, $height)
1647 0 0 if (my $actor = $where->first_child('activity:actor'))
1650 0 0 unless ($link_elt->att('rel') || $link_elt->att('atom:rel') || '') eq 'avatar'
1654 0 0 if defined $width and defined $this_width and $width < $this_width
1664 0 0 if (defined $url)
1675 0 0 if (my $image_elt = $where->first_child('image'))
1678 0 0 if ($url_elt = $image_elt->first_child('url')) { }
1688 0 0 if ($image_elt->text =~ /]*\ssrc="([^"]*)/)
1694 0 0 if (is_non_empty($url))
1696 0 0 unless (&Scalar::Util::looks_like_number($width) and $width > 0)
1700 0 0 unless (&Scalar::Util::looks_like_number($height) and $height > 0)
1741 0 0 if ($url)
1742 0 0 unless (&Scalar::Util::looks_like_number($width) and $width > 0)
1745 0 0 unless (&Scalar::Util::looks_like_number($height) and $height > 0)
1756 0 0 if (my $elt = $where->first_child('statusnet:postIcon'))
1757 0 0 if (is_non_empty(my $url = $elt->att('rdf:resource')))
1768 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')))
1801 0 0 unless $$self{'get_icon'}
1815 0 0 unless $resp->headers->content_is_html
1822 0 0 if ($tagname eq 'link' and $$attr{'rel'} eq 'icon')
1837 0 0 unless (exists $$self{'download_face'}{$key})
1852 0 0 unless ($resp->is_success)
1863 0 0 if ($type eq 'image/vnd.microsoft.icon' or $type eq 'image/x-icon') { }
0 0 elsif ($type =~ m[^image/(.*)$]i) { }
1876 0 0 if ($type ne 'png' or $width == 0 or $height == 0 or $width > 48 or $height > 48)
1896 0 0 if ($width > 0 and $width > 2 * $height)
1920 0 0 if ($width == 0 or $height == 0)
1923 0 0 if ($width <= 48 and $height <= 48 and $type eq 'png')
1932 0 0 if ($width > 48 or $height > 48)
1934 0 0 if ($width <= 96 and $height <= 96) { }
1949 0 0 if ($ret != 0)
1966 0 0 unless eval { do { require Image::Magick } }
1973 0 0 if ($ret == 1)
1983 0 0 if ($ret == 1)
2000 0 0 if (eval { do { require XML::Liberal; 1 } })
2011 0 0 unless $self->have_xml_liberal
2015 0 0 if (my $doc = eval { do { $liberal->parse_string($xmlstr) } }) { }
2055 0 0 if (defined $attach_bytes)
2066 0 0 unless $self->nntp_post($top)
2092 0 0 unless ($resp->content_type =~ m[^text/])
2106 0 0 if ($resp->headers->content_is_html)
2115 0 0 if ($tagname eq 'meta' and lc($$attr{'property'} || '') eq 'og:type')
2140 0 0 unless $self->nntp_group_check($group)
2146 0 0 if ($resp->code == 304)
2150 0 0 unless ($resp->is_success)
2168 0 0 if $self->nntp_message_id_exists($msgid)
2195 0 0 if ($part)
2202 0 0 unless $self->nntp_post($top)
2214 0 0 unless $$self{'html_extract_main'}
2215 0 0 unless $resp->headers->content_is_html
2233 0 0 unless (defined $content)
2265 0 0 unless $url =~ m[^http://[^/]*yahoo\.com/.*\*(http://.*yahoo\.com.*)$]
2279 0 0 if ($$l{'uri'} and $$l{'uri'}->canonical =~ m[^http://groups\.google\.com/group/([^/]+)/])
2310 0 0 if ($resp->is_success)
2313 0 0 if ($content =~ /]*Refresh[^>]*checkForCookies/i)
2402 0 0 if ($$self{'verbose'} >= 2)
2410 0 0 if ($tag eq 'content' and atom_content_flavour($elt) ne 'link')
2420 0 0 if (defined $rel) { }
2424 0 0 if ($rel eq 'self' or $rel eq 'edit' or $rel eq 'service.edit' or $rel eq 'license')
2432 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') { }
2455 0 0 if ($self->atom_link_is_rss($elt)) { }
2456 0 0 defined $count ? :
2461 0 0 defined $count ? :
2482 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/) { }
2511 0 0 if (defined(my $count = $self->item_elt_comments_count($item, $elt))) { }
2520 0 0 if (defined(my $count = $self->item_elt_comments_count($item, $elt))) { }
2549 0 0 if (defined(my $length = $elt->att('atom:length') // $elt->att('length')))
2555 0 0 if ($tag eq 'enclosure' and defined(my $duration = non_empty($item->first_child_text('itunes:duration'))))
2557 0 0 unless ($duration =~ /:/)
2563 0 0 if (@paren)
2583 0 0 if (defined $str)
2594 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'))))
2620 0 0 if (my $uri = $$l{'uri'})
2623 0 0 if (my $prev_l = $seen{$canonical})
2630 0 0 if (is_empty($$l{'uri'}->fragment))
2634 0 0 if ($$prev_l{'name'} eq __('Link')) { }
0 0 elsif ($$l{'name'} eq __('Link')) { }
0 0 elsif ($$l{'name'} eq $$prev_l{'name'}) { }
2651 0 0 if ($$l{'uri'})
2656 0 0 if (defined(my $str = $self->item_to_lat_long_alt_str($item)))
2668 0 0 defined $label ? :
2773 0 0 unless my($lat, $long, $alt) = $self->item_to_lat_long_alt_values($item)
2779 0 0 if (&Scalar::Util::looks_like_number($lat))
2780 0 0 $lat >= 0 ? :
2787 0 0 if (&Scalar::Util::looks_like_number($long))
2788 0 0 $long >= 0 ? :
2793 0 0 if (is_non_empty($alt)) { }
2835 0 0 if (is_non_empty($lat))
2847 0 0 if (is_non_empty($str))
2856 0 0 if (my $elt = $item->first_child('statusnet:origin'))
2857 0 0 if (defined(my $lat = $elt->att('geo:lat')))
2877 0 0 unless @_
2890 0 0 if (defined(my $uri = $$l{'uri'}))
2892 0 0 if (defined(my $hreflang = $$l{'hreflang'}))
2895 0 0 if (defined(my $type = $$l{'type'}))
2978 0 0 if (my(@elts) = $item->children($tag))
2984 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') }))
3004 0 0 if $child = $elt->first_child('rdf:Description')
3016 0 0 if @from
3018 0 0 unless (@from)
3024 0 0 unless (@from)
3078 0 0 unless defined $elt
3094 0 0 if $rdfdesc = $elt->first_child('rdf:Description')
3132 0 0 if (is_empty($email))
3135 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) { }
3160 0 0 if (is_empty($email) and $display =~ /^$mailbox_re$/o) { }
3183 0 0 if (is_empty($display))
3184 0 0 if (is_empty($email)) { }
3190 0 0 if (is_empty($email)) { }
3205 0 0 unless defined $str
3208 0 0 if ($str =~ m[[^[:alnum:][:space:]!#\$%&'*+/=?^_`{|}~-]]) { }
3218 0 0 unless defined $str
3240 0 0 if (defined(my $str = $$self{'rss_newest_only'}))
3241 0 0 if ($str =~ /^\s*(\d+)\s*(minute|hour|day|week|month|year)s?\s*$/)
3252 0 0 if (defined(my $str = $$self{'rss_newest_only'}))
3253 0 0 if (&Scalar::Util::looks_like_number($str))
3265 0 0 if (defined(my $count = $self->rss_newest_only_count))
3266 0 0 if ($count == 0)
3276 0 0 if ($before != $after)
3282 0 0 if (defined(my $target_timet = $self->rss_newest_only_timet))
3285 0 0 unless not defined $got_timet
3288 0 0 if ($before != $after)
3294 0 0 if (defined(my $str = $$self{'rss_newest_only'}))
3389 0 0 if ($err and $err =~ /not well-formed \(invalid token\) at (line \d+, column \d+, byte (\d+))/)
3392 0 0 if ($byte >= 128)
3400 0 0 if ($twig->safe_parse($recoded_xml))
3414 0 0 if ($err)
3416 0 0 if (defined $liberal_xml)
3419 0 0 if ($twig->safe_parse($liberal_xml))
3434 0 0 if ($err)
3464 0 0 if (defined $$self{'uri'} and not $root->att_exists('xml:base'))
3485 0 0 if (is_non_empty(my $id = $item->first_child_text('id')))
3492 0 0 if (my $elt = $item->first_child('guid'))
3495 0 0 if (is_non_empty(my $str = collapse_whitespace($elt->text)))
3501 0 0 if ($isPermaLink)
3504 0 0 if (my $link = item_yahoo_permalink($item))
3507 0 0 if (defined $guid)
3560 0 0 if (@ids) { }
3665 0 0 if ($cap_severity)
3670 0 0 if ($cap_severity_high{$cap_severity})
3673 0 0 if ($cap_severity_normal{$cap_severity})
3676 0 0 if ($cap_severity_low{$cap_severity} or $wiki_importance eq 'minor')
3705 0 0 if ($cap_severity_urgent{$cap_severity})
3708 0 0 if ($cap_severity_normal{$cap_severity})
3793 0 0 if (my $elt = $item->first_child('content'))
3851 0 0 if ((($link->att('atom:rel') // $link->att('rel')) // '') eq 'license')
3880 0 0 if (my $generator = $channel->first_child('generator'))
3894 0 0 if (my $notice = $item->first_child('statusnet:notice_info'))
3895 0 0 if (defined(my $html = $notice->att('atom:source')))
3919 0 0 unless (defined $elt)
3921 0 0 if ($elt->att('atom:src') or $elt->att('src'))
3925 0 0 if (not defined $type or $type eq 'html' or $type eq 'xhtml' or $type eq 'application/xhtml+xml' or $type =~ m[^text/])
3937 0 0 is_ascii($fragment) ? :
3939 0 0 defined $base_uri ? :
3942 0 0 if (is_non_empty($language)) { }
3969 0 0 if (my $charset = $$self{'rss_charset_override'})
3971 0 0 if ($xml =~ s/(<\?xml[^>]*encoding="?)([^">]+)/$1$charset/i) { }
0 0 elsif ($xml =~ s/(<\?xml[^?>]*)/$1 encoding="$charset"/i) { }
3994 0 0 if ($field eq 'geocode' or $field eq 'parameter')
4002 0 0 if (is_non_empty($value))
4006 0 0 unless (@fields)
4017 0 0 if ($want_html) { }
4033 0 0 $_->tag eq 'media:group' ? :
4036 0 0 if $elt->tag =~ /^#/
4037 0 0 if App::RSS2Leafnode::XML::Twig::Other::elt_is_empty($elt)
4042 0 0 if $path =~ m[/xhtml]
4043 0 0 if $path =~ m[^/channel/item/(description|content:encoded)/]
4044 0 0 if exists $known{$path}
4058 0 0 if ($xml eq '')
4063 0 0 if ($want_html) { }
4098 0 0 if (defined(my $role = non_empty($elt->att('role'))))
4111 0 0 if (defined(my $type = non_empty($elt->att('type'))))
4114 0 0 if (defined(my $lang = non_empty($elt->att('lang'))))
4120 0 0 if (defined(my $size = non_empty($elt->att('fileSize'))))
4123 0 0 if (defined(my $duration = non_empty($elt->att('duration'))))
4124 0 0 unless ($duration =~ /:/)
4130 0 0 if (@paren)
4148 0 0 unless defined $elt
4151 0 0 if ($type eq 'xhtml')
4155 0 0 if ($type eq 'html') { }
4180 0 0 unless ($self->nntp_message_id_exists($msgid))
4200 0 0 if (defined $$self{'getting_rss_comments'})
4205 0 0 defined $list_post ? :
4274 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/]) { }
4303 0 0 $links_want_html ? :
4308 0 0 unless ($$b{'download'} || 0) <=> ($$a{'download'} || 0)
4311 0 0 $links_want_html ? :
4322 0 0 if (is_non_empty($content))
4329 0 0 if ($content_type eq 'text/plain') { }
4341 0 0 if (is_non_empty(my $content = $self->item_unknowns($item, $links_want_html)))
4343 0 0 $links_want_html ? :
4344 0 0 if (@parts) { }
4345 0 0 is_ascii($content) ? :
4356 0 0 if ($$self{'rss_get_links'})
4358 0 0 unless $$l{'download'}
4368 0 0 unless ($resp->is_success)
4375 0 0 if ($links_want_html) { }
4395 0 0 if ($links_want_html and $body_type eq 'html')
4401 0 0 if ($body_type eq 'html')
4405 0 0 if (defined $body_charset)
4412 0 0 if ($body_type eq 'text/plain')
4417 0 0 unless ($links_want_html)
4419 0 0 unless (is_empty($links_str))
4427 0 0 unless (is_empty($links_str))
4430 0 0 if ($links_want_html) { }
4435 0 0 is_ascii($links_str) ? :
4452 0 0 if ($attach_elt)
4470 0 0 unless $self->nntp_post($top)
4476 0 0 if ($$self{'rss_get_comments'})
4480 0 0 if (defined $comments_rss_url)
4485 0 0 if (defined $$status{'comments_count'} and defined $comments_count and $$status{'comments_count'} == $comments_count) { }
4515 0 0 unless $rel eq 'replies'
4516 0 0 unless $self->atom_link_is_rss($elt)
4519 0 0 if (is_non_empty($href))
4527 0 0 unless (defined $url)
4529 0 0 if (is_non_empty($u))
4563 0 0 unless $self->nntp_group_check($group)
4570 0 0 if (defined $$self{'getting_rss_comments'}) { }
4577 0 0 unless $self->status_etagmod_req($req, 1)
4583 0 0 if ($resp->code == 304)
4587 0 0 unless ($resp->is_success)
4596 0 0 unless $resp->decode
4604 0 0 if (defined $err)
4607 0 0 if ($resp->request->uri ne $url)
4619 0 0 if ($$self{'verbose'} >= 3)
4636 0 0 if ($$self{'verbose'} >= 2)
4638 0 0 if ($jar and my $str = $jar->as_string ne '') { }