Branch Coverage

blib/lib/XML/RSS/SimpleGen.pm
Criterion Covered Total %
branch 153 306 50.0


line true false branch
17 8 0 unless defined &DEBUG
180 19 1 if @_
181 14 6 if @_
182 0 20 if @_
187 0 20 -e 'rss.css' ? :
190 0 20 -e 'about_rss.html' ? :
293 9 3 unless @_
296 0 3 unless (defined $file and length $file and $file =~ /\S/)
309 3 0 if $XML::RSS::SimpleGen::DWIM and not $self->item_limit
359 11 0 if (grep((defined $_ && length $_), @params)) { }
369 6 5 if ($$self{'_first_seen'})
371 1 5 $$self{'_virgin_item_timestamp'} ? :
416 0 3 unless $seen
437 0 4 unless ($$seen{$$b[0] or ''} || 0) <=> ($$seen{$$a[0] or ''} || 0)
469 0 0 unless $url and $h and $w and $h =~ /^\d{1,3}$/s and $w =~ /^\d{1,3}$/s
481 0 0 if @_
482 0 0 if @_
483 0 0 if @_
518 0 3 unless defined $filename and length $filename
521 3 0 if $self->history_file
528 2 0 if (-e $filename and -f _ and -r _ and -s _)
530 0 2 unless open RSS, $filename
536 0 2 if ($content eq $new_content)
547 0 2 if ($content eq $new_content_without_builddate)
556 0 3 unless open RSS, ">$filename"
558 0 3 unless print RSS $new_content
560 0 3 unless close RSS
586 0 21 $XML::RSS::SimpleGen::DTD_pubid && $XML::RSS::SimpleGen::DTD_url ? :
21 0 $self->css ? :
1 20 $self->xsl ? :
613 21 0 unless $ns and keys %$ns
625 36 27 defined $_ ? :
630 21 0 if ($XML::RSS::SimpleGen::DWIM)
632 0 21 unless ($url =~ /^[a-z]+[a-z0-9]*:\S+$/s)
634 0 0 if ($title =~ /^[a-z]+[a-z0-9]*:\S+$/s) { }
0 0 elsif ($description =~ /^[a-z]+[a-z0-9]*:\S+$/s) { }
653 1 20 if $lang
654 0 1 unless defined $lang and not $lang =~ /^[iIxI]$/s and $lang =~ /^(?: # First subtag [xiIX] | [a-zA-Z]{2,3} ) (?: # Subtags thereafter - # separator [A-Za-z0-9]{1,8} # subtag )* $/sx
707 21 0 defined $_ && /\S/ ? :
713 0 33 if (ref $_) { }
21 12 elsif (defined $_) { }
719 0 11 if ($XML::RSS::SimpleGen::DWIM and not $url =~ /^[a-z]+[a-z0-9]*:\S+$/s)
721 0 0 if ($title =~ /^[a-z]+[a-z0-9]*:\S+$/s) { }
0 0 elsif ($description =~ /^[a-z]+[a-z0-9]*:\S+$/s) { }
743 0 21 if ($self->allow_duplicates) { }
744 0 0 unless $$self{'items'}
747 0 21 unless $$self{'items'}
748 1 16 if ($seen{$$i[0]}++) { }
757 6 15 if ($item_limit)
758 0 6 if (@items > abs $item_limit)
759 0 0 if ($item_limit > 0) { }
776 0 0 unless $url or $title or $description
777 15 1 length $title ? :
16 0 length $url ? :
0 16 length $description ? :
795 0 0 unless $self->image_url and $self->image_height and $self->image_width
876 0 6 if @_ > 1
879 1 5 unless defined $self
880 0 6 unless ref $self
883 0 6 unless defined $url and $url =~ /^[a-z]+[a-z0-9]*:\S+$/s
886 0 6 if ($XML::RSS::SimpleGen::Sleepy and $last_url_get_time)
888 0 0 if ($delay > 0) { }
904 4 10 if (defined($content = $self->_get($url)))
911 0 10 if ($$self{'_http_abort'}) { }
918 8 2 if ($delay)
922 2 4 unless (defined $content)
924 2 0 if ($headers and $headers =~ s/^/ /gm) { }
929 0 2 $count == 1 ? :
933 4 0 if ($XML::RSS::SimpleGen::Nativize_newlines)
943 0 4 unless defined wantarray
953 2 13 if (not $LWP::Simple::VERSION and $_[0] =~ m[^http://([^ \n\r\t/:\@]+)(?::(\d+))?(/\S*)?$]) { }
960 0 2 if ($XML::RSS::SimpleGen::BadPorts{$port})
965 0 2 unless defined $path
966 0 2 unless ref $self
983 0 2 unless ref $self
994 0 2 if $port != 80
1007 0 2 unless defined $n
1009 2 0 if ($buf =~ m[^HTTP/\d+\.\d+\s+(\d+)[^\012]*\012]) { }
1012 1 1 if ($code =~ /^30[1237]/s and $buf =~ /\012Location:\s*(\S+)/)
1015 0 1 if ($url =~ /^(file|mailto):/ or $$seen{$url}++ or scalar keys %$seen > 20)
1031 0 1 if $code eq '404' or $code eq '403'
1033 0 1 unless $code =~ /^2/
1048 0 3 unless (defined $hf and length $hf)
1057 1 2 unless (-e $hf and -s _)
1058 1 0 if $XML::RSS::SimpleGen::DWIM
1068 0 2 unless open IN, $hf
1075 0 3 unless @f = split(/\t/, $_, 3) and defined $f[0] and length $f[0]
1077 3 0 if $f[2]
1079 3 0 if ($f[1]) { }
1098 0 3 unless (defined $hf and length $hf)
1112 0 3 unless open HF, ">$hf"
1126 3 0 if ($r and $r > 0)
1129 0 6 if $key =~ /[\t\n\r]/
1130 0 6 if ($forget_before and $$last{$key} < $forget_before)
1263 0 0 $h & 1 ? :
1283 0 0 if ($XML::RSS::SimpleGen::CHUNK_MINUTES) { }
1321 0 1 unless defined $hour
1322 0 1 unless $hour <= 24 and $hour >= 0
1324 0 1 $hour == 24 ? :
1360 0 0 @_ ? :
1392 0 3 unless defined $day
1393 1 2 if ($day =~ /^[0-7]$/s) { }
1394 0 1 if $day == 7
1398 0 2 unless $is_day_name{$day}
1441 0 0 @_ ? :
1442 0 0 $_ == 7 ? :
0 0 $is_day_name{$_} ? :
0 0 /^[0-7]$/ ? :
1482 0 0 if @_ == 1
1486 0 0 unless $period
1489 0 0 if ($period =~ /^(yearly|monthly|weekly|daily|hourly)$/s) { }
1491 0 0 if @_ > 2
1492 0 0 if @_ > 3
1514 0 7 if @_ == 1
1518 0 7 if ($then =~ /^-?\d+$/s) { }
7 0 elsif ($then =~ m[^ \d\d\d\d # year (?: -\d\d # month (?: -\d\d # day (?: T\d\d:\d\d # hh:mm (?: :\d\d # seconds (?: \.\d+ # fractions of a second )? )? (?: # TZ offset Z # Zulu | (?: # or by offset: [-+] \d\d:\d\d # hh:mm, with leading '+' or '-' ) )? )? )? )? # The month was optional, but that # makes "1994" ambiguous -- a year or an epoch time? # I doubt anyone wants to write 2000, # esp as the default is basically == 1970. $ ]sx) { }
1585 0 0 if ($period_type eq 'monthly' or $period_type eq 'yearly') { }
1587 0 0 if ($period_type eq 'yearly') { }
0 0 elsif ($period_type eq 'monthly') { }
1588 0 0 unless $now =~ s/^....-/2000-/s
1590 0 0 unless $now =~ s/^....-..-/2000-01-/s
1634 0 0 if (@_ > 1) { }
1647 21 0 unless $$self{'updatePeriod'}
1717 0 0 if defined $c and length $c and $c =~ /\S/
1810 0 0 @_ == 1 ? :
21 0 @_ == 0 ? :
1825 0 0 if ($filename and $maxage and $maxage < ($age = -M $filename))
1842 21 0 unless $$self{'_comments'}
1861 8 144 if $attrname =~ /::/
1864 0 406 unless (@_ == 1 || @_ == 2 and ref $_[0])
1870 281 125 @_ == 1 ? :
1884 14 10 unless $XML::RSS::SimpleGen::CommonEnts{$1}
1905 0 136 unless defined $_
1906 0 136 if ref $_ eq 'SCALAR'
1907 1 135 unless length $_
1909 111 24 if (/^[\x00-\x7e]+$/s and not /[<>&]/s)
1919 43 43 if (s/^([^&<]+)//s) { }
30 13 elsif (s/^ ( &\# (?: (?: # dec ([0-9]{1,7}) )|(?: # or hex [xX]([0-9a-fA-F]{1,7}) ) ) ) \b ;? //sx) { }
0 13 elsif (s/^&([A-Za-z][A-Za-z0-9]{0,10})\b(;?)//s) { }
2 11 elsif (s/^()//s) { }
0 11 elsif (s/^(<[!?][^>]*>)//s) { }
6 5 elsif (s[^][]) { }
4 1 elsif (s[ ^ ( < ([a-zA-Z][a-zA-Z0-9\.\:\_\-]{0,72}) # the G.I. (?: \s+ [a-zA-Z][a-zA-Z0-9\.\:\_\-]{0,72} (?: # Attributes can be valueless! \s* = \s* (?: # Attribute value... (?: "[^"]*" # "foo bar" )|(?: '[^']*' # 'foo bar' )|(?: [^<>\n\r\t ]{0,90} # foobarbaz # 90 is my sane length-limit on unquoted attrvalues ) ) )? )* # any nubmer of attribs \s* # optional ending whitespace /? # optional emptiness flag > ) ][]x) { }
1 0 elsif (s/^(.)//s) { }
1943 2 28 if (defined $3 and exists $XML::RSS::SimpleGen::WinLameEntities{hex $3}) { }
2 26 elsif (defined $2 and exists $XML::RSS::SimpleGen::WinLameEntities{0 + $2}) { }
1961 0 0 if (exists $XML::RSS::SimpleGen::Entities{$1}) { }
0 0 elsif (exists $XML::RSS::SimpleGen::Entities{ucfirst lc $1}) { }
1980 4 2 if $XML::RSS::SimpleGen::IsBlockMarkup{lc $1}
2015 1 3 if $XML::RSS::SimpleGen::IsBlockMarkup{lc $2}
2030 30 49 if (ref $x) { }
2034 11 38 unless $x =~ /^[a-zA-Z0-9_'",\. ]*$/s
2198 0 28 unless $_[0]->can($method)