Branch Coverage

blib/lib/PPI/Xref.pm
Criterion Covered Total %
branch 266 380 70.0


line true false branch
61 8 29 if (defined $cache_directory)
62 0 8 unless ('PPI::Xref'->__is_readwrite_directory($cache_directory))
81 36 144 unless (defined $self->{'inc_dirs'})
82 35 1 $self->{'opt'}{'INC'} ? :
83 0 76 if ref $d
84 0 76 unless -d $d and -x $d
100 144 0 unless (exists $self->{'inc_file'}{$file})
102 0 295 unless ($self->{'opt'}{'__allow_relative'})
104 0 0 unless 'File::Spec'->file_name_is_absolute($d)
108 140 155 if (-f $f)
113 4 140 unless (exists $self->{'inc_file'}{$file})
123 94 79 unless (exists $self->{'module_file'}{$module_name})
139 130 12096 if $n->isa('PPI::Token::Comment')
140 13 12083 if $n->isa('PPI::Token::Pod')
142 627 11456 if $prev_ws and $curr_ws
154 182 18 unless (defined $file_id)
164 273 49 if (exists $self->{'file_packages'} and ref $self->{'file_packages'}{$file_id} and @{$self->{'file_packages'}{$file_id};})
188 154 2 if (defined $old_package and $old_package ne 'main')
204 0 100 if ($flatten_volume and $^O eq 'MSWin32')
231 0 64 if ($filename =~ /\.\./)
237 64 0 'File::Spec'->file_name_is_absolute($filename) ? :
248 1 187 unless -f $origfilename
250 0 187 unless (open $origfilefh, $origfilename)
268 8 28 unless -d $dir
306 0 36 unless (defined $blob)
311 0 36 unless ($self->__make_path_file($temp))
318 0 36 unless (sysopen $fh, $temp, 65, 420)
326 0 36 unless (defined $wrote and $wrote == $size)
331 0 36 unless (close $fh)
336 0 36 unless (rename $temp, $file)
346 0 36 if (-f $temp)
358 20 16 if ($self->{'opt'}{'cache_verbose'})
364 152 100 if (defined $self->{$k}{$file_id})
385 0 64 if $file eq '-'
388 0 64 unless defined $cache_directory
390 0 64 unless ($self->__is_readwrite_directory($cache_directory))
395 0 64 unless ($file =~ /\.p[ml]$/)
410 35 22 unless (sysopen $fh, $file, 0)
417 0 22 unless ($read == $size)
428 0 187 if $origfile eq '-'
438 56 131 if (defined $cache_directory)
440 56 0 if (defined $cache_filename)
441 25 31 if ($self->{'opt'}{'cache_verbose'})
445 21 35 if (defined $cached) { }
446 5 16 if ($self->{'opt'}{'cache_verbose'})
455 20 15 if ($self->{'opt'}{'cache_verbose'})
474 36 0 if ($self->__write_cachefile($cache_filename, $hash_current, $file_id, $file_mtime)) { }
476 20 16 if ($self->{'opt'}{'cache_verbose'})
480 35 1 unless ($had_cache)
484 0 0 if ($self->{'opt'}{'cache_verbose'})
514 5 0 if (defined $fileloc) { }
526 1 176 if (not defined $doc) { }
532 4 172 unless ($complete)
534 0 4 if (not $pseudo || -f $file) { }
0 4 elsif (not $pseudo || -s $file) { }
554 10 278 if ($file eq '-') { }
91 187 elsif ($self->{'seen_file'}{$file}) { }
187 0 elsif (not $self->{'seen_file'}{$file}++) { }
555 0 10 if ($self->{'opt'}{'process_verbose'})
560 0 10 unless defined $doc
564 0 6 if ($self->{'opt'}{'process_verbose'} and $self->{'opt'}{'recurse_verbose'})
568 18 169 if ($self->{'opt'}{'process_verbose'})
575 20 167 if ($hash_match) { }
582 1 166 unless defined $doc
587 36 20 if (defined $cache_filename and defined $hash_current and not $hash_match)
590 30 6 if ($self->__to_cache($cache_filename, $hash_current, $file_id, $file_mtime))
592 1 29 if (not $hash_match and defined $cached)
649 176 0 if ($self->{'__incs_flush'}{$file_id})
683 2230 7582 exists $elem->{'children'} ? :
684 1583 8229 if ($elem->isa('PPI::Token::Structure'))
686 558 1025 if ($elem->content eq '{') { }
558 467 elsif ($elem->content eq '}') { }
689 0 558 if ($scope_depth <= 0) { }
699 26 532 if (defined $prev_package and $package ne $prev_package)
710 1922 7890 if (@children)
711 247 1675 if ($elem->isa('PPI::Statement::Package') and @children >= 2) { }
457 1218 elsif ($elem->isa('PPI::Statement::Sub') and defined $elem->name and not $elem->forward) { }
968 250 elsif ($elem->isa('PPI::Statement')) { }
717 247 0 if (defined $package and length $package) { }
724 130 117 if (defined $prev_package) { }
725 130 0 if ($package ne $prev_package)
745 455 2 unless ($sub =~ /::/)
750 0 457 unless (defined $finish)
769 117 851 unless defined $include
773 173 678 if ($elem->isa('PPI::Statement::Include') and $stmt_content =~ /^(?:use|no|require)$/ and $include->isa('PPI::Token::Word') and not $include_content =~ /^v?5/) { }
50 628 elsif ($stmt_content =~ /^(?:require|do)$/ and $include->isa('PPI::Token::Quote')) { }
787 0 223 unless (defined $include)
794 173 50 if ($including_module) { }
50 0 elsif ($including_file) { }
798 5 168 unless (defined $include_file)
805 0 50 unless (defined $include_file)
809 218 5 if (defined $include_file)
810 215 3 if ($self->{'opt'}{'recurse'}) { }
828 558 8509 if ($elem->isa('PPI::Structure')) { }
830 558 0 if $elem->finish
832 558 0 if $elem->start
839 176 0 if (defined $elem) { }
0 0 elsif (@{$doc->{'children'};}) { }
868 32 11 if ($ref eq '') { }
10 1 elsif ($ref eq 'SCALAR') { }
878 1 41 unless (defined $file_id)
891 0 0 if ($self->{'opt'}{'process_verbose'} or $self->{'opt'}{'cache_verbose'})
903 0 0 if ($self->{'opt'}{'process_verbose'})
914 8 0 unless (defined $self->{'result_cache'}{'files'})
915 0 8 unless $self->{'file_id'}
924 1 0 unless (defined $self->{'result_cache'}{'total_lines'})
925 0 1 unless $self->{'file_lines'}
941 30 16 unless (defined $self->{'result_cache'}{'__file_ids'})
942 0 30 unless $FILE_ID
951 0 6 unless $self->{'file_counts'}
958 8 4 unless (defined $self->{'result_cache'}{'modules'})
959 0 8 unless $self->{'file_modules'}
980 4 5 unless (defined $self->{'result_cache'}{'missing_modules'})
984 1 3 unless $self->{'file_missing_modules'}
1016 0 3 unless $self->{'modules'}
1024 0 1 unless $self->{'missing_modules_files'}{$module}
1032 0 1 unless $self->{'missing_modules_lines'}{$module}
1034 0 0 unless $PPI::Xref::a->[0] cmp $PPI::Xref::b->[0]
1035 1 0 /^(.+):(\d+)$/ ? :
1043 2 2 unless $self->{'missing_modules_count'}{$module}
1050 2 1 unless (defined $self->{'result_cache'}{'parse_errors_files'})
1052 1 1 unless exists $self->{'file_parse_errors'}
1075 0 1 unless exists $self->{'file_parse_errors'}
1076 0 1 unless defined $file
1078 0 1 unless defined $file_id
1079 0 1 unless exists $self->{'file_parse_errors'}{$file_id}
1086 19 2 unless (defined $self->{'result_cache'}{$cache})
1087 0 19 unless $self->{$key}
1112 6 0 unless (defined $self->{'result_cache'}{$cache})
1113 0 6 unless $self->{$key}
1123 0 2 unless $PPI::Xref::a->[0] cmp $PPI::Xref::b->[0] or $FILE_BY_ID{$PPI::Xref::a->[1]} cmp $FILE_BY_ID{$PPI::Xref::b->[1]} or $PPI::Xref::a->[2] <=> $PPI::Xref::b->[2]
1170 70 6 if ($self->{'ix'} < @{$self->{'it'};})
1198 12 12 $opt->{'finish'} ? :
12 34 $opt->{'finish'} ? :
24 46 $opt->{'column'} ? :
1228 1 0 unless (defined $self->{'result_cache'}{'__incs_files'})
1244 0 5 unless $FILE_BY_ID{$PPI::Xref::a->[0]} cmp $FILE_BY_ID{$PPI::Xref::b->[0]} or $PPI::Xref::a->[1] <=> $PPI::Xref::b->[1] or $PPI::Xref::a->[2] <=> $PPI::Xref::b->[2]
1263 0 0 $opt->{'finish'} ? :
0 7 $opt->{'finish'} ? :
0 7 $opt->{'column'} ? :
1280 7 1 if ($self->{'ix'} < @{$self->{'it'};})
1307 0 0 exists $self->{'file_incs'}{$file_id} ? :
1315 0 0 unless ($seen->{$next_file_id}++)
1320 0 0 if ($s == 0)
1328 4 0 unless (defined $self->{'result_cache'}{'__incs_deps'})
1333 19 6 if (exists $self->{'file_incs'}{$fi})
1347 9 16 exists $succ{$s} ? :
1348 15 10 exists $pred{$s} ? :
1349 16 9 if (@s == 0) { }
3 6 elsif (@p == 0) { }
1350 7 9 if (@p == 0) { }
1387 0 0 unless defined $file_id and exists $self->{$key}{$file_id}
1413 0 0 exists $self->{$key} ? :
1417 2 0 exists $self->{'root'} ? :
1421 2 0 exists $self->{'singleton'} ? :
1441 1 9 unless defined $file_id
1442 2 7 if exists $self->{'branch'}{$file_id}
1443 3 4 if exists $self->{'leaf'}{$file_id}
1444 3 1 if exists $self->{'root'}{$file_id}
1445 1 0 if exists $self->{'singleton'}{$file_id}
1463 2 0 if (defined $deps)
1467 4 8 unless (defined $iterself->{'path'} and @{$iterself->{'path'};})
1468 2 2 unless (defined $iterself->{'roots'})
1475 2 0 if (exists $self->{'__process'})
1477 0 2 unless exists $roots{$id}
1483 2 2 unless (defined $root)
1496 22 8 if (exists $deps->{'line'}{$curr})
1501 14 28 unless ($iterself->{'seen'}{$succ}{$line}++)
1510 16 14 unless ($pushed)
1511 16 0 if (my(@path) = @{$iterself->{'path'};})
1512 8 8 if $opt->{'reverse_chains'}
1513 14 2 if (@path > 1) { }
1515 8 6 if ($self->{'lastpush'})
1522 0 2 if (defined $kind and $kind eq 'singleton')
1555 8 2 if (my(@it) = $self->{'it'}{'next'}->($self))
1580 0 3 unless defined $cache_directory
1582 0 3 if $file =~ /\.\./
1590 0 3 unless (defined $cache_directory)
1596 0 3 if (not $file =~ m[^/] or $file =~ /\.\./ or not $file =~ /\.p[ml](?:\.cache)?$/)
1603 1 2 $file =~ /\.cache$/ ? :
1606 0 3 unless ($self->looks_like_cache_file($cache_file))
1610 3 0 if ($self->{'opt'}{'cache_verbose'})
1613 2 1 if (unlink $cache_file)
1625 0 1 unless defined $cache_directory
1627 0 1 unless $cache_filename =~ s/\.cache$//
1630 0 1 unless length $cache_filename > $cache_prefix_length
1633 0 1 unless $prefix =~ m[^\Q$cache_directory\E(?:/|\\)$]
1644 0 0 unless (defined $cache_directory)
1653 0 0 if (/\.p[ml]\.cache$/)
1671 0 0 if (/\.p[ml]$/)