Branch Coverage

blib/lib/XML/FeedPP.pm
Criterion Covered Total %
branch 522 692 75.4


line true false branch
480 0 75 unless defined $source
486 29 42 if (exists $$self{'rss'}) { }
18 24 elsif (exists $$self{'rdf:RDF'}) { }
23 1 elsif (exists $$self{'feed'}) { }
493 23 0 if exists $$self{'feed'}{-'xmlns'}
494 9 14 if ($xmlns eq $XML::FeedPP::XMLNS_ATOM10) { }
13 1 elsif ($xmlns eq $XML::FeedPP::XMLNS_ATOM03) { }
511 0 70 if ref $init
527 0 80 unless defined $source
529 77 3 unless ($method)
530 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) { }
549 0 78 if ($method eq 'url') { }
77 1 elsif ($method eq 'string') { }
1 0 elsif ($method eq 'file') { }
562 1 76 unless ref $tree
571 7 84 if $encode
581 0 0 if $encode
589 0 31 ref $source ? :
598 0 31 unless my $target = shift()
599 0 31 if (ref $self eq ref $target) { }
609 0 31 unless my $target = shift()
617 0 31 unless my $target = shift()
621 13 18 if not defined $title1 and defined $title2
625 8 23 if not defined $desc1 and defined $desc2
629 17 14 if not defined $link1 and defined $link2
633 10 21 if not defined $lang1 and defined $lang2
637 8 23 if not defined $right1 and defined $right2
641 10 21 if not defined $pubDate1 and defined $pubDate2
645 6 25 if not defined $image1[0] and defined $image2[0]
651 37 11 if exists $$xmlchk{$ns}
662 0 65 unless my $srcitem = shift()
663 0 65 unless my $link = $srcitem->link
666 3 62 if (ref $dstitem eq ref $srcitem) { }
674 27 35 if defined $title
677 9 53 if defined $description
680 27 35 if defined $category
683 9 53 if defined $author
686 35 27 if defined $guid
689 30 32 if defined $pubDate
702 67 23 if $key =~ /^-?(dc|rdf|xmlns):/
719 32 45 unless my $date = $item->get_pubDate_native
723 13 24 if $date
731 74 238 if (not defined $ns) { }
20 218 elsif (not defined $url) { }
736 0 20 unless exists $$root{'-' . $ns}
770 0 0 unless defined $class->VERSION
773 0 0 if $@
783 24 3 if ($$methods{$key}) { }
794 0 12 unless scalar @list
802 21 42 unless my $key = $$args[$i++]
804 30 12 $$methods{$key} ? :
805 15 27 unless ($got =~ /$test/)
810 21 15 unless ($unmatch)
811 0 21 unless wantarray
825 0 0 ref $class ? :
845 87 12 if ($$methods{$key}) { }
865 1 38 if (defined $source)
870 38 1 if ref $init
885 0 30 if (not ref $self && ref $$self{'rss'})
891 0 68 unless my $self = shift()
894 0 68 unless (UNIVERSAL::isa($$self{'rss'}, 'HASH'))
903 0 68 if (UNIVERSAL::isa($$self{'rss'}{'channel'}{'item'}, 'HASH'))
917 0 0 unless my $tree = shift()
931 0 97 unless ref $init or $link
932 23 85 if (ref $link)
937 74 11 if $link
938 11 74 if ref $init
951 0 7 unless my $list = $$self{'rss'}{'channel'}{'item'}
954 6 1 if ($remove =~ /^-?\d+/) { }
962 0 7 wantarray ? :
969 56 74 if (defined $num) { }
40 34 elsif (wantarray) { }
982 0 15 unless my $list = $$self{'rss'}{'channel'}{'item'}
983 14 23 unless $_->get_pubDate_epoch
993 0 13 unless my $list = $$self{'rss'}{'channel'}{'item'}
998 25 2 unless $$check{$link}++
1007 0 7 unless my $list = $$self{'rss'}{'channel'}{'item'}
1008 3 4 if ($limit > 0 and $limit < scalar @$list) { }
2 3 elsif ($limit < 0 and -$limit < scalar @$list) { }
1031 33 18 unless defined $date
1038 29 23 unless $$self{'rss'}{'channel'}->get_value('pubDate')
1045 4 28 if (defined $url) { }
5 23 elsif (exists $$self{'rss'}{'channel'}{'image'}) { }
1050 3 1 if defined $title
1051 3 1 if defined $link
1052 1 3 if defined $desc
1053 1 3 if defined $width
1054 1 3 if defined $height
1060 14 16 exists $$image{$key} ? :
1062 4 1 wantarray ? :
1085 7 38 if (scalar @_) { }
1088 30 8 unless $self->get_value('author')
1095 107 88 unless defined $link
1096 84 4 unless defined $self->guid
1103 126 98 unless defined $guid
1105 96 2 if (not scalar @args) { }
1 1 elsif (scalar @args == 1) { }
1118 42 53 unless defined $date
1125 44 75 unless $self->get_value('pubDate')
1132 0 0 if (defined $url) { }
0 0 elsif (exists $$self{'image'}) { }
1137 0 0 if defined $title
1138 0 0 if defined $link
1139 0 0 if defined $desc
1140 0 0 if defined $width
1141 0 0 if defined $height
1147 0 0 exists $$image{$key} ? :
1149 0 0 wantarray ? :
1166 1 29 if (defined $source)
1171 29 1 if ref $init
1186 0 19 if (not ref $self && ref $$self{'rdf:RDF'})
1191 0 48 unless my $self = shift()
1194 0 48 unless (UNIVERSAL::isa($$self{'rdf:RDF'}, 'HASH'))
1210 1 47 if (UNIVERSAL::isa($rdfseq, 'ARRAY'))
1212 3 0 if ref $_ and exists $$_{'rdf:li'}
1213 3 0 if ref $_
1214 1 0 if ($num1 and $num1 == $num2 and $num1 == $num3)
1222 0 48 if (UNIVERSAL::isa($$rdfseq{'rdf:li'}, 'HASH'))
1226 0 48 if (UNIVERSAL::isa($$self{'rdf:RDF'}{'item'}, 'HASH'))
1240 0 0 unless my $tree = shift()
1255 0 87 unless ref $init or $link
1256 28 70 if (ref $link)
1269 59 11 if $link
1270 11 59 if ref $init
1285 0 7 unless my $list = $$self{'rdf:RDF'}{'item'}
1288 6 1 if ($remove =~ /^-?\d+/) { }
1298 0 7 wantarray ? :
1305 35 65 if (defined $num) { }
32 33 elsif (wantarray) { }
1318 0 16 unless my $list = $$self{'rdf:RDF'}{'item'}
1319 10 32 unless $_->get_pubDate_epoch
1329 0 14 unless my $list = $$self{'rdf:RDF'}{'item'}
1334 30 2 unless $$check{$link}++
1343 0 7 unless my $list = $$self{'rdf:RDF'}{'item'}
1344 3 4 if ($limit > 0 and $limit < scalar @$list) { }
2 3 elsif ($limit < 0 and -$limit < scalar @$list) { }
1355 0 45 unless my $list = $$self{'rdf:RDF'}{'item'}
1378 29 16 unless defined $link
1387 32 16 unless defined $date
1401 2 23 if (defined $url) { }
3 20 elsif (exists $$self{'rdf:RDF'}{'image'}) { }
0 20 elsif (exists $$self{'rdf:RDF'}{'channel'}{'image'}) { }
1409 1 1 if defined $title
1410 1 1 if defined $link
1416 5 4 exists $$image{$key} ? :
1418 2 1 wantarray ? :
1446 21 5 unless defined $author
1454 200 73 unless defined $link
1462 37 58 unless defined $date
1485 3 32 if (defined $source)
1490 32 3 if ref $init
1497 0 26 if (not ref $self && ref $$self{'feed'})
1504 0 0 unless my $tree = shift()
1513 0 69 unless ref $init or $link
1514 14 66 if (ref $link)
1519 55 11 if $link
1520 11 55 if ref $init
1534 0 7 unless my $list = $$self{'feed'}{'entry'}
1537 6 1 if ($remove =~ /^-?\d+/) { }
1545 0 7 wantarray ? :
1552 34 69 if (defined $num) { }
29 40 elsif (wantarray) { }
1565 0 12 unless my $list = $$self{'feed'}{'entry'}
1566 8 20 unless $_->get_pubDate_epoch
1576 0 10 unless my $list = $$self{'feed'}{'entry'}
1581 16 2 unless $$check{$link}++
1589 0 7 unless my $list = $$self{'feed'}{'entry'}
1590 3 4 if ($limit > 0 and $limit < scalar @$list) { }
2 3 elsif ($limit < 0 and -$limit < scalar @$list) { }
1607 21 8 unless defined $lang
1617 2 25 if UNIVERSAL::isa($link, 'HASH')
1618 30 0 if ref $_ and exists $$_{'-rel'}
1628 6 21 if (defined $href) { }
8 13 elsif (ref $icon) { }
1630 6 0 if $ext
1632 1 5 if (ref $icon) { }
1634 1 0 if $type
1635 0 1 if $title
1641 5 0 if $type
1642 0 5 if $title
1644 5 0 if (UNIVERSAL::isa($flink, 'ARRAY')) { }
0 0 elsif (UNIVERSAL::isa($flink, 'HASH')) { }
1657 0 8 if exists $$icon{'-title'}
1658 2 6 wantarray ? :
1678 0 41 unless my $self = shift()
1683 0 41 unless (UNIVERSAL::isa($$self{'feed'}, 'HASH'))
1691 0 41 if (UNIVERSAL::isa($$self{'feed'}{'entry'}, 'HASH'))
1705 24 13 unless defined $title
1712 19 7 unless defined $desc
1720 23 14 unless defined $date
1727 15 22 unless $$self{'feed'}->get_value('modified')
1736 16 6 unless defined $copy
1746 10 35 if UNIVERSAL::isa($link, 'HASH')
1748 29 0 unless not exists $$_{'-rel'}
1751 20 1 unless not exists $$_{'-type'}
1756 18 27 if (defined $href) { }
19 8 elsif (ref $html) { }
1757 2 16 if (ref $html) { }
1767 16 0 if (not ref $flink) { }
0 0 elsif (UNIVERSAL::isa($flink, 'ARRAY')) { }
0 0 elsif (UNIVERSAL::isa($flink, 'HASH')) { }
1799 0 17 unless my $self = shift()
1804 0 17 unless (UNIVERSAL::isa($$self{'feed'}, 'HASH'))
1812 0 17 if (UNIVERSAL::isa($$self{'feed'}{'entry'}, 'HASH'))
1826 14 3 unless defined $title
1833 9 3 unless defined $desc
1843 7 2 unless defined $date
1850 5 4 unless $$self{'feed'}->get_value('updated')
1859 6 2 unless defined $copy
1869 6 12 if UNIVERSAL::isa($link, 'HASH')
1871 11 1 unless not exists $$_{'-rel'}
1876 6 12 if (defined $href) { }
9 3 elsif (ref $html) { }
1877 1 5 if (ref $html) { }
1886 5 0 if (not ref $flink) { }
0 0 elsif (UNIVERSAL::isa($flink, 'ARRAY')) { }
0 0 elsif (UNIVERSAL::isa($flink, 'HASH')) { }
1928 6 65 if (UNIVERSAL::isa($value, 'HASH') and exists $$value{'-type'} and $$value{'-type'} eq 'xhtml')
1932 6 0 if (scalar @$child == 1)
1934 6 0 if ($div =~ /^([^:]+:)?div$/i)
1964 22 9 unless (defined $name)
1965 13 9 if ref $$self{'author'}
1968 0 9 ref $name ? :
1985 16 8 unless defined $desc
1999 11 109 if UNIVERSAL::isa($link, 'HASH')
2001 67 0 unless not exists $$_{'-rel'}
2004 66 1 unless not exists $$_{'-type'}
2009 56 64 if (defined $href) { }
64 0 elsif (ref $html) { }
2010 3 53 if (ref $html) { }
2020 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')) { }
2030 52 4 unless defined $self->guid
2041 19 38 unless defined $date
2049 6 0 unless $self->get_value('modified') or $self->get_value('issued') or $self->get_value('updated')
2060 23 25 unless defined $title
2075 15 3 unless defined $desc
2085 7 23 if UNIVERSAL::isa($link, 'HASH')
2087 2 16 unless not exists $$_{'-rel'}
2092 14 16 if (defined $href) { }
16 0 elsif (ref $html) { }
2093 1 13 if (ref $html) { }
2102 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')) { }
2112 13 1 unless defined $self->guid
2123 9 4 unless defined $date
2130 17 0 unless $self->get_value('updated') or $self->get_value('published') or $self->get_value('issued')
2142 11 5 unless defined $title
2148 15 20 if (scalar @_) { }
2149 5 10 ref $_[0] ? :
2151 6 9 scalar @$list > 1 ? :
2154 0 20 unless exists $$self{'category'}
2156 11 9 if defined $list and not UNIVERSAL::isa($list, 'ARRAY')
2157 36 0 if ref $_ and exists $$_{-'term'}
2159 9 11 scalar @$term > 1 ? :
2190 18 18 if (ref $$node{$child}) { }
0 18 elsif (defined $$node{$child}) { }
2202 6 121 if ($tagname eq '' and defined $attr) { }
59 62 elsif (defined $attr) { }
62 0 elsif (defined $tagname) { }
2206 1 58 if (ref $$node{$tagname} and UNIVERSAL::isa($$node{$tagname}, 'ARRAY'))
2211 25 34 if (ref $$node{$tagname}) { }
15 19 elsif (defined $$node{$tagname}) { }
2225 0 62 if (ref $$node{$tagname} and UNIVERSAL::isa($$node{$tagname}, 'ARRAY'))
2229 8 54 if (ref $$node{$tagname}) { }
2246 0 84 unless ref $node
2247 12 72 unless exists $$node{$child}
2251 12 204 unless ref $node
2253 7 197 if ($tagname eq '' and defined $attr) { }
98 99 elsif (defined $attr) { }
2254 0 7 unless exists $$node{'-' . $attr}
2258 18 80 unless ref $$node{$tagname}
2260 8 72 if (UNIVERSAL::isa($$node{$tagname}, 'ARRAY'))
2261 8 20 ref $_ && exists $$_{$hkey} ? :
2264 4 4 if wantarray
2267 0 72 unless exists $$node{$tagname}{$hkey}
2271 69 30 unless ref $$node{$tagname}
2272 1 29 if (UNIVERSAL::isa($$node{$tagname}, 'ARRAY'))
2273 2 2 ref $_ ? :
2276 1 0 if wantarray
2287 21 132 if (ref $value) { }
29 103 elsif (defined $value) { }
2290 0 29 if scalar @_
2294 36 67 scalar @ret > 1 ? :
2302 233 532 scalar @_ ? :
2309 962 1080 unless exists $$self{$elem}
2311 915 165 unless ref $value
2314 42 123 if (UNIVERSAL::isa($value, 'ARRAY'))
2315 39 3 if (wantarray) { }
2329 118 227 if (UNIVERSAL::isa($value, 'HASH')) { }
27 200 elsif (UNIVERSAL::isa($value, 'SCALAR')) { }
2331 118 0 if (exists $$value{'#text'})
2347 13 823 if (UNIVERSAL::isa($$self{$elem}, 'HASH')) { }
2353 158 678 if scalar @$attr
2361 0 0 unless exists $$self{$elem}
2362 0 0 unless ref $$self{$elem}
2363 0 0 unless exists $$self{$elem}{'-' . $key}
2371 158 0 if (defined $$self{$elem}) { }
2373 5 153 if $scalar eq 'SCALAR'
2374 145 13 unless ($scalar)
2384 173 0 if (defined $val) { }
2425 0 15 unless defined $epoch
2429 0 15 $tz_offset ? :
2436 0 12 unless defined $epoch
2439 0 12 $tz_offset ? :
2446 0 101 unless defined $str
2448 0 101 unless $year and $mon and $mday
2449 6 95 if $year < 77
2450 4 97 if $year < 100
2451 0 101 unless $mon = $MoY{uc $mon}
2452 64 37 if (defined $tz and $tz ne '' and $tz ne 'GMT') { }
2465 0 51 unless defined $str
2467 0 51 unless $year > 1900 and $mon and $mday
2473 35 16 if (defined $tz and $tz ne '' and $tz ne 'Z') { }
2488 0 52 unless defined $str
2490 0 52 unless $year and $mon and $mday
2491 6 46 if $year < 77
2492 4 48 if $year < 100
2493 0 52 unless $mon = $MoY{uc $mon}
2501 0 73 unless defined $str
2503 0 73 unless $year > 1900 and $mon and $mday
2514 58 166 unless defined $tz
2515 8 158 if exists $$tzmap{$tz}
2516 0 158 unless $tz =~ /^([\+\-]?)(\d+):?(\d{2})$/
2519 74 84 $pm eq '-' ? :
2525 37 181 unless defined $date
2526 6 175 if ($date =~ /^\d+$/s) { }
81 94 elsif ($date =~ /$rfc1123_regexp/) { }
94 0 elsif ($date =~ /$w3cdtf_regexp/) { }
2540 0 96 unless defined $date
2541 3 93 if ($date =~ /^\d+$/s) { }
42 51 elsif ($date =~ /$rfc1123_regexp/) { }
51 0 elsif ($date =~ /$w3cdtf_regexp/) { }
2555 32 97 unless defined $date
2556 0 97 if ($date =~ /^\d+$/s) { }
33 64 elsif ($date =~ /$rfc1123_regexp/) { }
64 0 elsif ($date =~ /$w3cdtf_regexp/) { }
2569 0 3 unless my $base = shift()
2570 0 3 unless my $merge = shift()
2573 0 31 if exists $$map{$key}
2574 6 25 if exists $$base{$key}
2580 216 340 if (scalar(@_) % 2 == 0) { }