Branch Coverage

blib/lib/Pod/Simple.pm
Criterion Covered Total %
branch 206 292 70.5


line true false branch
6 67 0 unless defined &Pod::Simple::DEBUG
33 0 67 if (defined &Pod::Simple::ASCII) { }
37 67 0 unless (defined &Pod::Simple::MANY_LINES)
39 0 67 unless (&MANY_LINES() >= 1)
42 0 67 if (defined &Pod::Simple::UNICODE) { }
67 0 elsif ($] >= 5.008) { }
149 19 0 unless @_
152 0 0 if ($this->{'_processed_encoding'}) { }
154 0 0 if (not $this->{'encoding_command_statuses'}) { }
0 0 elsif ($this->{'encoding_command_statuses'}[-1]) { }
183 0 0 if ($class eq 'Pod::Simple') { }
203 10 867 unless @_
206 867 0 defined $_[0] && ref $_[0] ? :
207 77 790 unless defined $$x
270 0 9 unless defined $d and length $d
271 0 9 unless $d =~ /^[a-zA-Z][a-zA-Z0-9]*$/s
274 0 9 if exists $Pod::Simple::Known_directives{$d}
281 0 9 if wantarray
293 0 0 unless defined $d and length $d
294 0 0 unless $d =~ /^[a-zA-Z][a-zA-Z0-9]*$/s
297 0 0 if exists $Pod::Simple::Known_directives{$d}
301 0 0 if wantarray
321 0 570 unless defined $t and length $t
326 0 311 if wantarray
336 0 0 unless defined $t and length $t
341 0 0 if wantarray
361 0 1211 unless defined $new_code and length $new_code
363 0 1211 if $new_code =~ /$xml_name_re/ or $new_code =~ /^[-\.0-9]/s or $new_code =~ /:[-\.0-9]/s
393 0 29 unless defined $new_code and length $new_code
395 0 29 if $new_code =~ /$xml_name_re/ or $new_code =~ /^[-\.0-9]/s or $new_code =~ /:[-\.0-9]/s
403 0 29 if grep(($new_code eq $_), @Pod::Simple::Known_formatting_codes)
422 18 743 unless defined $line_group and length $line_group
429 2909 743 if length $1 or length $2 or pos $line_group != length $line_group
456 0 51 if (not defined $source) { }
0 51 elsif (ref \$source eq 'GLOB') { }
0 51 elsif (ref $source) { }
0 51 elsif (not length $source) { }
467 0 51 unless open PODSOURCE, "<$source"
484 51 9275 unless defined $lines[-1]
489 51 439 if $at_eof
498 51 439 if $at_eof
513 0 10 unless ref $self
515 0 10 if (not defined $source) { }
0 10 elsif (ref \$source eq 'GLOB') { }
0 10 elsif (ref $source) { }
0 10 elsif (not length $source or $source eq '-' or $source =~ /^<&(?:STDIN|0)$/i) { }
524 0 10 if (not defined $to) { }
0 10 elsif (ref \$to eq 'GLOB') { }
0 10 elsif (ref $to) { }
0 10 elsif (not length $to or $to eq '-' or $to =~ /^>&?(?:STDOUT|1)$/i) { }
0 10 elsif ($to =~ /^>&(?:STDERR|2)$/i) { }
537 0 10 unless open $out_fh, ">$to"
538 0 10 if $self->can('write_with_binmode') and $self->write_with_binmode
552 9 70 if ($self->{'no_whining'})
557 0 70 if $self->{'complain_stderr'}
566 0 8 if $self->{'complain_stderr'}
578 10 68 if ($self->{'no_errata_section'}) { }
593 0 185 if $para->[1]{'~type'}
596 2 183 if join("\n", @{$para;}[2 .. $#$para]) =~ /^\s*(\d+)\.?\s*$/s and $1 ne '1'
605 185 1020 if $para->[1]{'~type'}
612 59 961 if ($content =~ /^\s*\*\s*$/s or $content =~ /^\s*$/s) { }
101 860 elsif ($content =~ /^\s*\*\s+(.+)/s) { }
31 829 elsif ($content =~ /^\s*(\d+)\.?\s*$/s) { }
648 0 4443 unless (@_)
650 0 4443 if (ref $_[0] and ref $_[0][0] and $_[0][0][0] eq '~Top') { }
663 1080 3363 if (not $self->{'_output_is_for_JustPod'} and $self->_remap_sequences($treelet)) { }
688 341 739 unless $nixx or $merge
701 6 6186 if ($nixx and ref $treelet->[$i] and $treelet->[$i][0] eq 'X') { }
25 6161 elsif ($merge and $i != 2 and not ref $treelet->[$i] and not ref $$treelet[$i - 1]) { }
1742 4419 elsif (ref $treelet->[$i]) { }
723 206 1536 if ($treelet->[$i][0] eq 'L')
726 236 176 if (defined($thing = $treelet->[$i][1]{$attrname}) and ref $thing)
747 2501 1080 if (@stack == 1 and @{$stack[0];} == 3 and not ref $stack[0][2])
775 5147 2404 unless ref $treelet->[$i]
793 4 2400 unless (defined $is)
799 2 2402 if (ref $is) { }
0 2402 elsif ($is eq '0') { }
4 2398 elsif ($is eq '1') { }
832 0 1080 if (@_ == 2 and @{$_[1];} == 3 and not ref $_[1][2])
853 21 0 if ($content =~ /^ (\S+) # 1 : new item \s+ (\S+) # 2 : fallback(s) (?:\s+(\S+))? # 3 : element name(s) \s* $ /sx) { }
866 21 0 defined $3 ? :
870 0 21 unless ($new_letter =~ /^[A-Z]$/s or $new_letter)
879 0 21 if (grep(($new_letter eq $_), @Pod::Simple::Known_formatting_codes))
891 0 0 unless ($fallbacks_one =~ /^[A-Z](,[A-Z])*$/s or $fallbacks_one eq '0' or $fallbacks_one eq '1')
903 0 21 unless ($elements_one =~ /^[^ ,]+(,[^ ,]+)*$/s)
916 0 0 if exists $Pod::Simple::Known_formatting_codes{$f} or $f eq '0' or $f eq '1'
930 15 27 if (exists $self->{'accept_codes'}{$e}) { }
940 15 6 if (defined $canonical_form) { }
947 2 4 @fallbacks == 1 ? :
976 5112 2403 unless ref $treelet->[$i]
977 2366 37 unless ($treelet->[$i][0] eq 'Z')
985 0 37 unless (@{$treelet->[$i];} == 2 or @{$treelet->[$i];} == 3 and $treelet->[$i][2] eq '')
1083 5100 2334 unless ref $treelet->[$i]
1084 1991 343 unless ($treelet->[$i][0] eq 'L')
1095 1 342 if (@{$ell;} == 3 and $ell->[2] =~ m[\A\s*/\s*\z])
1100 0 342 if (@{$ell;} == 2 or @{$ell;} == 3 and $ell->[2] eq '')
1108 2 340 if (not ref $ell->[2] and $ell->[2] =~ /\A\s/ or not ref $ell->[-1] and $ell->[-1] =~ /\s\z/)
1133 44 298 if (my($url_index, $text_part, $url_part) = sub { foreach $_ (2 .. $#$ell) { next if ref $ell->[$_]; next unless $ell->[$_] =~ /^(?:([^|]*)\|)?(\w+:[^:\s]\S*)$/s; return $_, $1, $2; } ; return; } ->())
1138 136 448 if ref $ell->[$_]
1139 404 44 unless $ell->[$_] =~ /^(?:([^|]*)\|)?(\w+:[^:\s]\S*)$/s
1148 14 30 if defined $text_part
1153 30 14 unless (@text)
1158 33 11 @url == 1 ? :
1170 223 75 if (@{$ell;} == 3 and not ref $ell->[2])
1172 6 217 if ($it =~ m[^[^/|]+[(][-a-zA-Z0-9]+[)]$]s)
1183 127 90 if ($it =~ /^[^\/\|,\$\%\@\ \"\<\>\:\#\&\*\{\}\[\]\(\)]+(\:\:[^\/\|,\$\%\@\ \"\<\>\:\#\&\*\{\}\[\]\(\)]+)*$/s)
1217 119 260 if ref $ell_content[$j]
1221 61 199 if ($ell_content[$j] =~ /^([^\|]*)\|(.*)$/s)
1228 1 60 if ($link_text[0] =~ m[[|/]])
1253 35 183 if ref $ell_content[$j]
1257 100 83 if ($ell_content[$j] =~ m[^([^/]*)/(.*)$]s)
1272 40 60 if (@section_name and not ref $section_name[0] and not ref $section_name[-1] and $section_name[0] =~ /^\"/s and $section_name[-1] =~ /\"$/s and not @section_name == 1 && $section_name[0] eq '"') { }
1295 19 0 if (not $section_name and @ell_content and not ref $ell_content[0] and not ref $ell_content[-1] and $ell_content[0] =~ /^\"/s and $ell_content[-1] =~ /\"$/s and not @ell_content == 1 && $ell_content[0] eq '"')
1310 14 4 if (not $section_name || $link_text and @ell_content and grep((!ref($_) && / /s), @ell_content))
1324 104 61 unless ($link_text)
1327 100 4 if $section_name
1329 51 53 if (@ell_content)
1330 47 4 if $section_name
1338 9 156 if (@ell_content == 1 and not ref $ell_content[0] and $ell_content[0] =~ m[^[^/]+[(][-a-zA-Z0-9]+[)]$]s) { }
1348 133 32 if (defined $section_name)
1355 93 72 if (@ell_content)
1363 165 0 defined $link_text ? :
1391 5628 2477 unless ref $treelet->[$i]
1392 342 2135 if ($treelet->[$i][0] eq 'L') { }
1851 284 elsif ($treelet->[$i][0] ne 'E') { }
1397 403 281 if (defined($thing = $treelet->[$i][1]{$attrname}) and ref $thing)
1415 0 284 if (@{$treelet->[$i];} == 2 or @{$treelet->[$i];} == 3 and $treelet->[$i][2] eq '')
1424 0 284 unless (@{$treelet->[$i];} == 3 and not ref($content = $treelet->[$i][2]))
1446 6 278 if (not defined $charnum) { }
0 278 elsif ($charnum >= 255 and !1) { }
1472 505 575 if $self->{'nbsp_for_S'}
1491 1175 2789 if (ref $treelet->[$i]) { }
1492 12 1163 if (_change_S_to_nbsp($treelet->[$i], $in_s))
1499 18 2771 if $in_s
1519 102 2398 if $attrname =~ /::/
1522 0 10508 unless @_ == 1 || @_ == 2 and ref $_[0]
1527 6454 4054 @_ == 1 ? :
1543 0 0 if (ref($source || '') eq 'SCALAR') { }
0 0 elsif (ref $source) { }
1563 197 327 if @_ and ref($_[0] || '') eq 'CODE'
1569 1 523 ref $class && $class->isa('Pod::Simple') ? :
1576 197 327 if $mutor
1591 0 56 unless wantarray
1594 19 37 if @_ and ref($_[0] || '') eq 'CODE'
1596 0 56 unless @_ == 2
1611 38 74 if $mutor