Branch Coverage

blib/lib/XML/FeedPP.pm
Criterion Covered Total %
branch 537 718 74.7


line true false branch
487 0 179 if $do_autodetect and not $source
491 80 99 if $source
493 71 104 if ($do_autodetect)
495 1 70 unless ($class)
496 1 0 ref $self ? :
497 1 0 ref $self ? :
503 75 99 if $source
505 99 75 if ref $init
511 75 0 if $self->test_feed(@_)
512 0 0 ref $self ? :
513 0 0 ref $self ? :
522 70 84 if $hit
540 0 80 unless defined $source
542 77 3 unless ($method)
543 0 77 if ($source =~ m[^https?://]s) { }
75 2 elsif ($source =~ /(?:\s*\xEF\xBB\xBF)?\s* (<(\?xml|!DOCTYPE|rdf:RDF|rss|feed)\W)/six) { }
0 2 elsif (not $source =~ /[\r\n]/ and -f $source) { }
562 0 78 if ($method eq 'url') { }
77 1 elsif ($method eq 'string') { }
1 0 elsif ($method eq 'file') { }
575 1 76 unless ref $tree
584 7 84 if $encode
594 0 0 if $encode
602 0 31 ref $source ? :
611 0 31 unless my $target = shift()
612 0 31 if (ref $self eq ref $target) { }
622 0 31 unless my $target = shift()
630 0 31 unless my $target = shift()
634 13 18 if not defined $title1 and defined $title2
638 8 23 if not defined $desc1 and defined $desc2
642 17 14 if not defined $link1 and defined $link2
646 10 21 if not defined $lang1 and defined $lang2
650 8 23 if not defined $right1 and defined $right2
654 10 21 if not defined $pubDate1 and defined $pubDate2
658 6 25 if not defined $image1[0] and defined $image2[0]
664 37 11 if exists $xmlchk->{$ns}
675 0 65 unless my $srcitem = shift()
676 0 65 unless my $link = $srcitem->link
679 3 62 if (ref $dstitem eq ref $srcitem) { }
685 1 2 if (my $guid = $srcitem->{'guid'})
691 28 34 if defined $title
694 9 53 if defined $description
697 27 35 if defined $category
700 9 53 if defined $author
703 35 27 if defined $guid
706 30 32 if defined $pubDate
719 67 23 if $key =~ /^-?(dc|rdf|xmlns):/
736 32 45 unless my $date = $item->get_pubDate_native
740 13 24 if $date
748 74 238 if (not defined $ns) { }
20 218 elsif (not defined $url) { }
753 0 20 unless exists $$root{'-' . $ns}
787 0 0 unless defined $class->VERSION
790 0 0 if $@
800 24 3 if ($methods->{$key}) { }
811 0 12 unless scalar @list
819 21 42 unless my $key = $$args[$i++]
821 30 12 $methods->{$key} ? :
822 15 27 unless ($got =~ /$test/)
827 21 15 unless ($unmatch)
828 0 21 unless wantarray
865 0 0 ref $class ? :
885 87 12 if ($methods->{$key}) { }
910 0 101 unless ref $source
911 42 59 unless ref $source->{'rss'}
916 0 68 unless my $self = shift()
919 0 68 unless (UNIVERSAL::isa($self->{'rss'}, 'HASH'))
928 0 68 UNIVERSAL::isa($items, 'HASH') ? :
939 0 0 unless my $tree = shift()
953 0 97 unless ref $init or $link
954 23 85 if (ref $link)
959 74 11 if $link
960 11 74 if ref $init
973 0 7 unless my $list = $self->{'rss'}{'channel'}{'item'}
976 6 1 if ($remove =~ /^-?\d+/) { }
984 0 7 wantarray ? :
991 57 74 if (defined $num) { }
40 34 elsif (wantarray) { }
1004 0 15 unless my $list = $self->{'rss'}{'channel'}{'item'}
1005 14 23 unless $_->get_pubDate_epoch
1015 0 13 unless my $list = $self->{'rss'}{'channel'}{'item'}
1019 25 2 unless $check{$key}++
1028 0 7 unless my $list = $self->{'rss'}{'channel'}{'item'}
1029 3 4 if ($limit > 0 and $limit < scalar @$list) { }
2 3 elsif ($limit < 0 and -$limit < scalar @$list) { }
1052 33 18 unless defined $date
1060 29 23 unless $self->{'rss'}{'channel'}->get_value('pubDate')
1066 4 28 if (defined $url) { }
5 23 elsif (exists $self->{'rss'}{'channel'}{'image'}) { }
1071 3 1 if defined $title
1072 3 1 if defined $link
1073 1 3 if defined $desc
1074 1 3 if defined $width
1075 1 3 if defined $height
1081 14 16 exists $image->{$key} ? :
1083 4 1 wantarray ? :
1106 7 38 if (scalar @_) { }
1109 30 8 unless $self->get_value('author')
1116 81 86 unless defined $link
1117 84 2 unless defined $self->guid
1124 152 100 unless defined $guid
1126 98 2 if (not scalar @args) { }
1 1 elsif (scalar @args == 1) { }
1139 42 53 unless defined $date
1146 44 75 unless $self->get_value('pubDate')
1153 0 0 if (defined $url) { }
0 0 elsif (exists $self->{'image'}) { }
1158 0 0 if defined $title
1159 0 0 if defined $link
1160 0 0 if defined $desc
1161 0 0 if defined $width
1162 0 0 if defined $height
1168 0 0 exists $image->{$key} ? :
1170 0 0 wantarray ? :
1192 0 61 unless ref $source
1193 24 37 unless ref $source->{'rdf:RDF'}
1198 0 48 unless my $self = shift()
1201 0 48 unless (UNIVERSAL::isa($self->{'rdf:RDF'}, 'HASH'))
1217 1 47 if (UNIVERSAL::isa($rdfseq, 'ARRAY'))
1219 3 0 if ref $_ and exists $_->{'rdf:li'}
1220 3 0 if ref $_
1221 1 0 if ($num1 and $num1 == $num2 and $num1 == $num3)
1229 0 48 if (UNIVERSAL::isa($rdfseq->{'rdf:li'}, 'HASH'))
1233 0 48 if (UNIVERSAL::isa($self->{'rdf:RDF'}{'item'}, 'HASH'))
1247 0 0 unless my $tree = shift()
1263 0 87 unless ref $init or $link
1264 28 70 if (ref $link)
1277 59 11 if $link
1278 11 59 if ref $init
1293 0 7 unless my $list = $self->{'rdf:RDF'}{'item'}
1296 6 1 if ($remove =~ /^-?\d+/) { }
1306 0 7 wantarray ? :
1313 36 65 if (defined $num) { }
32 33 elsif (wantarray) { }
1326 0 16 unless my $list = $self->{'rdf:RDF'}{'item'}
1327 10 32 unless $_->get_pubDate_epoch
1337 0 14 unless my $list = $self->{'rdf:RDF'}{'item'}
1341 30 2 unless $check{$link}++
1350 0 7 unless my $list = $self->{'rdf:RDF'}{'item'}
1351 3 4 if ($limit > 0 and $limit < scalar @$list) { }
2 3 elsif ($limit < 0 and -$limit < scalar @$list) { }
1362 0 45 unless my $list = $self->{'rdf:RDF'}{'item'}
1385 29 16 unless defined $link
1394 32 16 unless defined $date
1408 2 23 if (defined $url) { }
3 20 elsif (exists $self->{'rdf:RDF'}{'image'}) { }
0 20 elsif (exists $self->{'rdf:RDF'}{'channel'}{'image'}) { }
1416 1 1 if defined $title
1417 1 1 if defined $link
1423 5 4 exists $image->{$key} ? :
1425 2 1 wantarray ? :
1453 21 5 unless defined $author
1461 200 73 unless defined $link
1469 37 58 unless defined $date
1488 0 0 unless my $tree = shift()
1497 0 69 unless ref $init or $link
1498 14 66 if (ref $link)
1503 55 11 if $link
1504 11 55 if ref $init
1518 0 7 unless my $list = $self->{'feed'}{'entry'}
1521 6 1 if ($remove =~ /^-?\d+/) { }
1529 0 7 wantarray ? :
1536 35 69 if (defined $num) { }
29 40 elsif (wantarray) { }
1549 0 12 unless my $list = $self->{'feed'}{'entry'}
1550 8 20 unless $_->get_pubDate_epoch
1560 0 10 unless my $list = $self->{'feed'}{'entry'}
1564 16 2 unless $check{$link}++
1572 0 7 unless my $list = $self->{'feed'}{'entry'}
1573 3 4 if ($limit > 0 and $limit < scalar @$list) { }
2 3 elsif ($limit < 0 and -$limit < scalar @$list) { }
1590 21 8 unless defined $lang
1600 2 25 if UNIVERSAL::isa($link, 'HASH')
1605 30 0 if ref $_ and exists $_->{'-rel'}
1611 6 21 if (defined $href) { }
8 13 elsif (ref $icon) { }
1613 6 0 if $ext
1615 1 5 if (ref $icon) { }
1617 1 0 if $type
1618 0 1 if $title
1624 5 0 if $type
1625 0 5 if $title
1627 5 0 if (UNIVERSAL::isa($flink, 'ARRAY')) { }
0 0 elsif (UNIVERSAL::isa($flink, 'HASH')) { }
1640 0 8 if exists $icon->{'-title'}
1641 2 6 wantarray ? :
1663 0 29 unless ref $source
1664 1 28 unless ref $source->{'feed'}
1665 0 28 unless exists $source->{'feed'}{'-xmlns'}
1667 1 27 if $xmlns ne $XML::FeedPP::XMLNS_ATOM03
1672 0 41 unless my $self = shift()
1677 0 41 unless (UNIVERSAL::isa($self->{'feed'}, 'HASH'))
1685 0 41 if (UNIVERSAL::isa($self->{'feed'}{'entry'}, 'HASH'))
1699 24 13 unless defined $title
1707 19 7 unless defined $desc
1714 23 14 unless defined $date
1722 15 22 unless $self->{'feed'}->get_value('modified')
1731 16 6 unless defined $copy
1740 10 35 if UNIVERSAL::isa($link, 'HASH')
1743 29 0 unless not exists $_->{'-rel'}
1746 20 1 unless not exists $_->{'-type'}
1750 18 27 if (defined $href) { }
19 8 elsif (ref $html) { }
1751 2 16 if (ref $html) { }
1761 16 0 if (not ref $flink) { }
0 0 elsif (UNIVERSAL::isa($flink, 'ARRAY')) { }
0 0 elsif (UNIVERSAL::isa($flink, 'HASH')) { }
1795 0 34 unless ref $source
1796 1 33 unless ref $source->{'feed'}
1797 0 33 unless exists $source->{'feed'}{'-xmlns'}
1799 14 19 if $xmlns ne $XML::FeedPP::XMLNS_ATOM10
1804 0 17 unless my $self = shift()
1809 0 17 unless (UNIVERSAL::isa($self->{'feed'}, 'HASH'))
1817 0 17 if (UNIVERSAL::isa($self->{'feed'}{'entry'}, 'HASH'))
1831 14 3 unless defined $title
1841 9 3 unless defined $desc
1848 7 2 unless defined $date
1856 5 4 unless $self->{'feed'}->get_value('updated')
1865 6 2 unless defined $copy
1874 6 12 if UNIVERSAL::isa($link, 'HASH')
1877 11 1 unless not exists $_->{'-rel'}
1881 6 12 if (defined $href) { }
9 3 elsif (ref $html) { }
1882 1 5 if (ref $html) { }
1891 5 0 if (not ref $flink) { }
0 0 elsif (UNIVERSAL::isa($flink, 'ARRAY')) { }
0 0 elsif (UNIVERSAL::isa($flink, 'HASH')) { }
1919 0 4 unless ref $source
1920 1 3 unless ref $source->{'feed'}
1941 6 65 if (UNIVERSAL::isa($value, 'HASH') and exists $value->{'-type'} and $value->{'-type'} eq 'xhtml')
1945 6 0 if (scalar @$child == 1)
1947 6 0 if ($div =~ /^([^:]+:)?div$/i)
1977 22 9 unless (defined $name)
1978 13 9 if ref $self->{'author'}
1981 0 9 ref $name ? :
1998 16 8 unless defined $desc
2012 10 96 if UNIVERSAL::isa($link, 'HASH')
2015 53 0 unless not exists $_->{'-rel'}
2018 52 1 unless not exists $_->{'-type'}
2022 54 52 if (defined $href) { }
52 0 elsif (ref $html) { }
2023 1 53 if (ref $html) { }
2033 53 0 if (not ref $flink) { }
0 0 elsif (ref $flink and UNIVERSAL::isa($flink, 'ARRAY')) { }
0 0 elsif (ref $flink and UNIVERSAL::isa($flink, 'HASH')) { }
2043 52 2 unless defined $self->guid
2054 19 38 unless defined $date
2062 6 0 unless $self->get_value('modified') or $self->get_value('issued') or $self->get_value('updated')
2073 23 25 unless defined $title
2088 15 3 unless defined $desc
2098 7 17 if UNIVERSAL::isa($link, 'HASH')
2101 2 10 unless not exists $_->{'-rel'}
2105 14 10 if (defined $href) { }
10 0 elsif (ref $html) { }
2106 1 13 if (ref $html) { }
2115 13 0 if (not ref $flink) { }
0 0 elsif (ref $flink and UNIVERSAL::isa($flink, 'ARRAY')) { }
0 0 elsif (ref $flink and UNIVERSAL::isa($flink, 'HASH')) { }
2125 13 1 unless defined $self->guid
2136 9 4 unless defined $date
2143 17 0 unless $self->get_value('updated') or $self->get_value('published') or $self->get_value('issued')
2155 11 5 unless defined $title
2161 15 20 if (scalar @_) { }
2162 5 10 ref $_[0] ? :
2164 6 9 scalar @$list > 1 ? :
2167 0 20 unless exists $self->{'category'}
2169 11 9 if defined $list and not UNIVERSAL::isa($list, 'ARRAY')
2170 36 0 if ref $_ and exists $_->{'-term'}
2172 9 11 scalar @$term > 1 ? :
2203 18 18 if (ref $node->{$child}) { }
0 18 elsif (defined $node->{$child}) { }
2215 6 121 if ($tagname eq '' and defined $attr) { }
59 62 elsif (defined $attr) { }
62 0 elsif (defined $tagname) { }
2219 1 58 if (ref $node->{$tagname} and UNIVERSAL::isa($node->{$tagname}, 'ARRAY'))
2224 25 34 if (ref $node->{$tagname}) { }
4 30 elsif (defined $node->{$tagname}) { }
2238 0 62 if (ref $node->{$tagname} and UNIVERSAL::isa($node->{$tagname}, 'ARRAY'))
2242 19 43 if (ref $node->{$tagname}) { }
2259 0 84 unless ref $node
2260 12 72 unless exists $node->{$child}
2264 12 204 unless ref $node
2266 7 197 if ($tagname eq '' and defined $attr) { }
98 99 elsif (defined $attr) { }
2267 0 7 unless exists $$node{'-' . $attr}
2271 18 80 unless ref $node->{$tagname}
2273 8 72 if (UNIVERSAL::isa($node->{$tagname}, 'ARRAY'))
2275 8 20 ref $_ && exists $_->{$hkey} ? :
2277 4 4 if wantarray
2280 0 72 unless exists $node->{$tagname}{$hkey}
2284 69 30 unless ref $node->{$tagname}
2285 1 29 if (UNIVERSAL::isa($node->{$tagname}, 'ARRAY'))
2287 2 2 ref $_ ? :
2289 1 0 if wantarray
2300 21 132 if (ref $value) { }
29 103 elsif (defined $value) { }
2303 0 29 if scalar @_
2307 36 67 scalar @ret > 1 ? :
2315 236 549 scalar @_ ? :
2322 964 1095 unless (exists $self->{$elem})
2328 963 1 unless defined $elem
2332 906 190 unless ref $value
2335 42 148 if (UNIVERSAL::isa($value, 'ARRAY'))
2336 39 3 if (wantarray) { }
2350 143 252 if (UNIVERSAL::isa($value, 'HASH'))
2353 143 0 defined $value->{'#text'} ? :
2357 27 225 if (UNIVERSAL::isa($value, 'SCALAR'))
2370 15 824 if (UNIVERSAL::isa($self->{$elem}, 'HASH')) { }
2376 160 679 if scalar @$attr
2384 0 0 unless exists $self->{$elem}
2385 0 0 unless ref $self->{$elem}
2386 0 0 unless exists $self->{$elem}{'-' . $key}
2394 160 0 if (defined $self->{$elem}) { }
2396 5 155 if $scalar eq 'SCALAR'
2397 145 15 unless ($scalar)
2407 175 0 if (defined $val) { }
2448 0 15 unless defined $epoch
2452 0 15 $tz_offset ? :
2459 0 12 unless defined $epoch
2462 0 12 $tz_offset ? :
2469 0 101 unless defined $str
2471 0 101 unless $year and $mon and $mday
2472 6 95 if $year < 77
2473 4 97 if $year < 100
2474 0 101 unless $mon = $MoY{uc $mon}
2475 64 37 if (defined $tz and $tz ne '' and $tz ne 'GMT') { }
2488 0 51 unless defined $str
2490 0 51 unless $year > 1900 and $mon and $mday
2494 0 51 unless my $epoch = eval { do { Time::Local::timegm($sec, $min, $hour, $mday, $mon - 1, $year) } }
2498 35 16 if (defined $tz and $tz ne '' and $tz ne 'Z') { }
2513 0 52 unless defined $str
2515 0 52 unless $year and $mon and $mday
2516 6 46 if $year < 77
2517 4 48 if $year < 100
2518 0 52 unless $mon = $MoY{uc $mon}
2519 0 52 unless my $epoch = eval { do { Time::Local::timegm($sec, $min, $hour, $mday, $mon - 1, $year) } }
2527 0 73 unless defined $str
2529 0 73 unless $year > 1900 and $mon and $mday
2533 0 73 unless my $epoch = eval { do { Time::Local::timegm($sec, $min, $hour, $mday, $mon - 1, $year) } }
2542 58 166 unless defined $tz
2543 8 158 if exists $tzmap->{$tz}
2544 0 158 unless $tz =~ /^([\+\-]?)(\d+):?(\d{2})$/
2547 74 84 $pm eq '-' ? :
2553 37 181 unless defined $date
2554 6 175 if ($date =~ /^\d+$/s) { }
81 94 elsif ($date =~ /$rfc1123_regexp/) { }
94 0 elsif ($date =~ /$w3cdtf_regexp/) { }
2568 0 96 unless defined $date
2569 3 93 if ($date =~ /^\d+$/s) { }
42 51 elsif ($date =~ /$rfc1123_regexp/) { }
51 0 elsif ($date =~ /$w3cdtf_regexp/) { }
2583 32 97 unless defined $date
2584 0 97 if ($date =~ /^\d+$/s) { }
33 64 elsif ($date =~ /$rfc1123_regexp/) { }
64 0 elsif ($date =~ /$w3cdtf_regexp/) { }
2597 0 3 unless my $base = shift()
2598 0 3 unless my $merge = shift()
2602 6 25 if $exclude{$key} or exists $base->{$key}
2608 216 340 if (scalar(@_) % 2 == 0) { }