Branch Coverage

blib/lib/App/RSS2Leafnode.pm
Criterion Covered Total %
branch 0 732 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'})
854 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::/)
1573 0 0 unless (eval { do { $content = &Encode::decode($charset, $content); 1 } })
1606 0 0 unless $msg =~ /^Unknown configure option/
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)
3140 0 0 unless defined $elt
3159 0 0 if $rdfdesc = $elt->first_child('rdf:Description')
3166 0 0 if (defined $display and not defined $email)
3169 0 0 if ($owner = $channel->first_child(qr/(itunes:)?owner/) and defined($name = elt_to_rendered_line($owner->first_child(qr/^(itunes:)?name$/))) and $name eq $display || $name eq $maybe)
3214 0 0 if (is_empty($email))
3217 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) { }
3242 0 0 if (is_empty($email) and $display =~ /^$mailbox_re$/o) { }
3265 0 0 if (is_empty($display))
3266 0 0 if (is_empty($email)) { }
3272 0 0 if (is_empty($email)) { }
3287 0 0 unless defined $str
3290 0 0 if ($str =~ m[[^[:alnum:][:space:]!#\$%&'*+/=?^_`{|}~-]]) { }
3300 0 0 unless defined $str
3322 0 0 if (defined(my $str = $self->{'rss_newest_only'}))
3323 0 0 if ($str =~ /^\s*(\d+)\s*(minute|hour|day|week|month|year)s?\s*$/)
3334 0 0 if (defined(my $str = $self->{'rss_newest_only'}))
3335 0 0 if (&Scalar::Util::looks_like_number($str))
3347 0 0 if (defined(my $count = $self->rss_newest_only_count))
3348 0 0 if ($count == 0)
3358 0 0 if ($before != $after)
3364 0 0 if (defined(my $target_timet = $self->rss_newest_only_timet))
3367 0 0 unless not defined $got_timet
3370 0 0 if ($before != $after)
3376 0 0 if (defined(my $str = $self->{'rss_newest_only'}))
3476 0 0 if ($err and $err =~ /not well-formed \(invalid token\) at (line \d+, column \d+, byte (\d+))/)
3479 0 0 if ($byte >= 128)
3487 0 0 if ($twig->safe_parse($recoded_xml))
3501 0 0 if ($err)
3503 0 0 if (defined $liberal_xml)
3506 0 0 if ($twig->safe_parse($liberal_xml))
3521 0 0 if ($err)
3551 0 0 if (defined $self->{'uri'} and not $root->att_exists('xml:base'))
3574 0 0 if (is_non_empty(my $id = $item->first_child_text('id')))
3581 0 0 if (my $elt = $item->first_child('guid'))
3584 0 0 if (is_non_empty(my $str = collapse_whitespace($elt->text)))
3590 0 0 if ($isPermaLink)
3593 0 0 if (my $link = item_yahoo_permalink($item))
3596 0 0 if (defined $guid)
3649 0 0 if (@ids) { }
3754 0 0 if ($cap_severity)
3759 0 0 if ($cap_severity_high{$cap_severity})
3762 0 0 if ($cap_severity_normal{$cap_severity})
3765 0 0 if ($cap_severity_low{$cap_severity} or $wiki_importance eq 'minor')
3794 0 0 if ($cap_severity_urgent{$cap_severity})
3797 0 0 if ($cap_severity_normal{$cap_severity})
3882 0 0 if (my $elt = $item->first_child('content'))
3940 0 0 if ((($link->att('atom:rel') // $link->att('rel')) // '') eq 'license')
3969 0 0 if (my $generator = $channel->first_child('generator'))
3983 0 0 if (my $notice = $item->first_child('statusnet:notice_info'))
3984 0 0 if (defined(my $html = $notice->att('atom:source')))
4008 0 0 unless (defined $elt)
4010 0 0 if ($elt->att('atom:src') or $elt->att('src'))
4014 0 0 if (not defined $type or $type eq 'html' or $type eq 'xhtml' or $type eq 'application/xhtml+xml' or $type =~ m[^text/])
4026 0 0 is_ascii($fragment) ? :
4028 0 0 defined $base_uri ? :
4031 0 0 if (is_non_empty($language)) { }
4058 0 0 if (my $charset = $self->{'rss_charset_override'})
4060 0 0 if ($xml =~ s/(<\?xml[^>]*encoding="?)([^">]+)/$1$charset/i) { }
0 0 elsif ($xml =~ s/(<\?xml[^?>]*)/$1 encoding="$charset"/i) { }
4083 0 0 if ($field eq 'geocode' or $field eq 'parameter')
4091 0 0 if (is_non_empty($value))
4095 0 0 unless (@fields)
4106 0 0 if ($want_html) { }
4122 0 0 $_->tag eq 'media:group' ? :
4125 0 0 if $elt->tag =~ /^#/
4126 0 0 if App::RSS2Leafnode::XML::Twig::Other::elt_is_empty($elt)
4131 0 0 if $path =~ m[/xhtml]
4132 0 0 if $path =~ m[^/channel/item/(description|content:encoded)/]
4133 0 0 if exists $known{$path}
4147 0 0 if ($xml eq '')
4152 0 0 if ($want_html) { }
4187 0 0 if (defined(my $role = non_empty($elt->att('role'))))
4200 0 0 if (defined(my $type = non_empty($elt->att('type'))))
4203 0 0 if (defined(my $lang = non_empty($elt->att('lang'))))
4209 0 0 if (defined(my $size = non_empty($elt->att('fileSize'))))
4212 0 0 if (defined(my $duration = non_empty($elt->att('duration'))))
4213 0 0 unless ($duration =~ /:/)
4219 0 0 if (@paren)
4237 0 0 unless defined $elt
4240 0 0 if ($type eq 'xhtml')
4244 0 0 if ($type eq 'html') { }
4269 0 0 unless ($self->nntp_message_id_exists($msgid))
4289 0 0 if (defined $self->{'getting_rss_comments'})
4294 0 0 defined $list_post ? :
4364 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/]) { }
4393 0 0 $links_want_html ? :
4399 0 0 unless ($App::RSS2Leafnode::b->{'download'} || 0) <=> ($App::RSS2Leafnode::a->{'download'} || 0)
4401 0 0 $links_want_html ? :
4412 0 0 if (is_non_empty($content))
4419 0 0 if ($content_type eq 'text/plain') { }
4431 0 0 if (is_non_empty(my $content = $self->item_unknowns($item, $links_want_html)))
4433 0 0 $links_want_html ? :
4434 0 0 if (@parts) { }
4435 0 0 is_ascii($content) ? :
4446 0 0 if ($self->{'rss_get_links'})
4448 0 0 unless $l->{'download'}
4458 0 0 unless ($resp->is_success)
4465 0 0 if ($links_want_html) { }
4485 0 0 if ($links_want_html and $body_type eq 'html')
4491 0 0 if ($body_type eq 'html')
4495 0 0 if (defined $body_charset)
4502 0 0 if ($body_type eq 'text/plain')
4507 0 0 unless ($links_want_html)
4509 0 0 unless (is_empty($links_str))
4517 0 0 unless (is_empty($links_str))
4520 0 0 if ($links_want_html) { }
4525 0 0 is_ascii($links_str) ? :
4542 0 0 if ($attach_elt)
4560 0 0 unless $self->nntp_post($top)
4566 0 0 if ($self->{'rss_get_comments'})
4570 0 0 if (defined $comments_rss_url)
4575 0 0 if (defined $status->{'comments_count'} and defined $comments_count and $status->{'comments_count'} == $comments_count) { }
4605 0 0 unless $rel eq 'replies'
4606 0 0 unless $self->atom_link_is_rss($elt)
4609 0 0 if (is_non_empty($href))
4617 0 0 unless (defined $url)
4619 0 0 if (is_non_empty($u))
4653 0 0 unless $self->nntp_group_check($group)
4660 0 0 if (defined $self->{'getting_rss_comments'}) { }
4667 0 0 unless $self->status_etagmod_req($req, 1)
4673 0 0 if ($resp->code == 304)
4677 0 0 unless ($resp->is_success)
4687 0 0 unless $resp->decode
4695 0 0 if (defined $err)
4698 0 0 if ($resp->request->uri ne $url)
4710 0 0 if ($self->{'verbose'} >= 3)
4727 0 0 if ($self->{'verbose'} >= 2)
4729 0 0 if ($jar and my $str = $jar->as_string ne '') { }