Branch Coverage

blib/lib/PPI/Xref.pm
Criterion Covered Total %
branch 270 392 68.8


line true false branch
63 8 29 if (defined $cache_directory)
64 0 8 unless ('PPI::Xref'->__is_readwrite_directory($cache_directory))
83 36 144 unless (defined $self->{'inc_dirs'})
84 35 1 $self->{'opt'}{'INC'} ? :
85 0 76 if ref $d
86 0 76 unless -d $d and -x $d
102 144 0 unless (exists $self->{'inc_file'}{$file})
104 0 295 unless ($self->{'opt'}{'__allow_relative'})
106 0 0 unless 'File::Spec'->file_name_is_absolute($d)
110 140 155 if (-f $f)
115 4 140 unless (exists $self->{'inc_file'}{$file})
125 94 79 unless (exists $self->{'module_file'}{$module_name})
141 130 12096 if $n->isa('PPI::Token::Comment')
142 13 12083 if $n->isa('PPI::Token::Pod')
144 627 11456 if $prev_ws and $curr_ws
156 182 18 unless (defined $file_id)
166 273 49 if (exists $self->{'file_packages'} and ref $self->{'file_packages'}{$file_id} and @{$self->{'file_packages'}{$file_id};})
190 154 2 if (defined $old_package and $old_package ne 'main')
206 0 100 if ($flatten_volume and $^O eq 'MSWin32')
235 0 64 if ($filename =~ /\.\./)
241 64 0 'File::Spec'->file_name_is_absolute($filename) ? :
259 1 187 unless -f $origfilename
261 0 187 unless (open $origfilefh, $origfilename)
279 8 28 unless -d $dir
317 0 36 unless (defined $blob)
322 0 36 unless ($self->__make_path_file($temp))
329 0 36 unless (sysopen $fh, $temp, 65, 420)
337 0 36 unless (defined $wrote and $wrote == $size)
342 0 36 unless (close $fh)
347 0 36 unless (rename $temp, $file)
357 0 36 if (-f $temp)
369 0 36 if $self->{'opt'}{'cache_read_only'}
371 20 16 if ($self->{'opt'}{'cache_verbose'})
377 152 100 if (defined $self->{$k}{$file_id})
398 0 64 if $path eq '-'
401 0 64 unless defined $cache_directory
403 0 64 unless ($self->__is_readwrite_directory($cache_directory))
408 0 64 unless ($path =~ /\.p[ml]$/)
422 35 22 unless (sysopen $fh, $file, 0)
429 0 22 unless ($read == $size)
440 0 187 if $origfile eq '-'
450 56 131 if (defined $cache_directory)
452 56 0 if (defined $cache_filename)
453 25 31 if ($self->{'opt'}{'cache_verbose'})
457 21 35 if (defined $cached) { }
458 5 16 if ($self->{'opt'}{'cache_verbose'})
467 20 15 if ($self->{'opt'}{'cache_verbose'})
485 0 36 if $self->{'opt'}{'cache_read_only'}
488 36 0 if ($self->__write_cachefile($cache_filename, $hash_current, $file_id, $file_mtime)) { }
490 20 16 if ($self->{'opt'}{'cache_verbose'})
494 35 1 unless ($had_cache)
498 0 0 if ($self->{'opt'}{'cache_verbose'})
528 5 0 if (defined $fileloc) { }
540 1 176 if (not defined $doc) { }
546 4 172 unless ($complete)
548 0 4 if (not $pseudo || -f $file) { }
0 4 elsif (not $pseudo || -s $file) { }
568 10 278 if ($file eq '-') { }
91 187 elsif ($self->{'seen_file'}{$file}) { }
187 0 elsif (not $self->{'seen_file'}{$file}++) { }
569 0 10 if ($self->{'opt'}{'process_verbose'})
574 0 10 unless defined $doc
578 0 6 if ($self->{'opt'}{'process_verbose'} and $self->{'opt'}{'recurse_verbose'})
582 18 169 if ($self->{'opt'}{'process_verbose'})
589 20 167 if ($hash_match) { }
167 0 elsif (not $self->{'opt'}{'cache_read_only'}) { }
596 1 166 unless defined $doc
601 36 20 if (defined $cache_filename and defined $hash_current and not $hash_match and not $self->{'opt'}{'cache_read_only'})
605 30 6 if ($self->__to_cache($cache_filename, $hash_current, $file_id, $file_mtime))
607 1 29 if (not $hash_match and defined $cached)
664 176 0 if ($self->{'__incs_flush'}{$file_id})
698 2230 7582 exists $elem->{'children'} ? :
699 1583 8229 if ($elem->isa('PPI::Token::Structure'))
701 558 1025 if ($elem->content eq '{') { }
558 467 elsif ($elem->content eq '}') { }
704 0 558 if ($scope_depth <= 0) { }
714 26 532 if (defined $prev_package and $package ne $prev_package)
725 1922 7890 if (@children)
726 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')) { }
732 247 0 if (defined $package and length $package) { }
739 130 117 if (defined $prev_package) { }
740 130 0 if ($package ne $prev_package)
760 455 2 unless ($sub =~ /::/)
765 0 457 unless (defined $finish)
784 117 851 unless defined $include
788 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')) { }
802 0 223 unless (defined $include)
809 173 50 if ($including_module) { }
50 0 elsif ($including_file) { }
813 5 168 unless (defined $include_file)
820 0 50 unless (defined $include_file)
824 218 5 if (defined $include_file)
825 215 3 if ($self->{'opt'}{'recurse'}) { }
843 558 8509 if ($elem->isa('PPI::Structure')) { }
845 558 0 if $elem->finish
847 558 0 if $elem->start
854 176 0 if (defined $elem) { }
0 0 elsif (@{$doc->{'children'};}) { }
883 32 11 if ($ref eq '') { }
10 1 elsif ($ref eq 'SCALAR') { }
893 1 41 unless (defined $file_id)
906 0 0 if ($self->{'opt'}{'process_verbose'} or $self->{'opt'}{'cache_verbose'})
918 0 0 if ($self->{'opt'}{'process_verbose'})
929 8 0 unless (defined $self->{'result_cache'}{'files'})
930 0 8 unless $self->{'file_id'}
939 1 0 unless (defined $self->{'result_cache'}{'total_lines'})
940 0 1 unless $self->{'file_lines'}
956 30 16 unless (defined $self->{'result_cache'}{'__file_ids'})
957 0 30 unless $FILE_ID
966 0 6 unless $self->{'file_counts'}
973 8 4 unless (defined $self->{'result_cache'}{'modules'})
974 0 8 unless $self->{'file_modules'}
995 4 5 unless (defined $self->{'result_cache'}{'missing_modules'})
999 1 3 unless $self->{'file_missing_modules'}
1031 0 3 unless $self->{'modules'}
1039 0 1 unless $self->{'missing_modules_files'}{$module}
1047 0 1 unless $self->{'missing_modules_lines'}{$module}
1049 0 0 unless $PPI::Xref::a->[0] cmp $PPI::Xref::b->[0]
1050 1 0 /^(.+):(\d+)$/ ? :
1058 2 2 unless $self->{'missing_modules_count'}{$module}
1065 2 1 unless (defined $self->{'result_cache'}{'parse_errors_files'})
1067 1 1 unless exists $self->{'file_parse_errors'}
1090 0 1 unless exists $self->{'file_parse_errors'}
1091 0 1 unless defined $file
1093 0 1 unless defined $file_id
1094 0 1 unless exists $self->{'file_parse_errors'}{$file_id}
1101 19 2 unless (defined $self->{'result_cache'}{$cache})
1102 0 19 unless $self->{$key}
1127 6 0 unless (defined $self->{'result_cache'}{$cache})
1128 0 6 unless $self->{$key}
1138 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]
1185 70 6 if ($self->{'ix'} < @{$self->{'it'};})
1213 12 12 $opt->{'finish'} ? :
12 34 $opt->{'finish'} ? :
24 46 $opt->{'column'} ? :
1243 1 0 unless (defined $self->{'result_cache'}{'__incs_files'})
1259 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]
1278 0 0 $opt->{'finish'} ? :
0 7 $opt->{'finish'} ? :
0 7 $opt->{'column'} ? :
1295 7 1 if ($self->{'ix'} < @{$self->{'it'};})
1322 0 0 exists $self->{'file_incs'}{$file_id} ? :
1330 0 0 unless ($seen->{$next_file_id}++)
1335 0 0 if ($s == 0)
1343 4 0 unless (defined $self->{'result_cache'}{'__incs_deps'})
1348 19 6 if (exists $self->{'file_incs'}{$fi})
1362 9 16 exists $succ{$s} ? :
1363 15 10 exists $pred{$s} ? :
1364 16 9 if (@s == 0) { }
3 6 elsif (@p == 0) { }
1365 7 9 if (@p == 0) { }
1402 0 0 unless defined $file_id and exists $self->{$key}{$file_id}
1428 0 0 exists $self->{$key} ? :
1432 2 0 exists $self->{'root'} ? :
1436 2 0 exists $self->{'singleton'} ? :
1456 1 9 unless defined $file_id
1457 2 7 if exists $self->{'branch'}{$file_id}
1458 3 4 if exists $self->{'leaf'}{$file_id}
1459 3 1 if exists $self->{'root'}{$file_id}
1460 1 0 if exists $self->{'singleton'}{$file_id}
1478 2 0 if (defined $deps)
1482 4 8 unless (defined $iterself->{'path'} and @{$iterself->{'path'};})
1483 2 2 unless (defined $iterself->{'roots'})
1490 2 0 if (exists $self->{'__process'})
1492 0 2 unless exists $roots{$id}
1498 2 2 unless (defined $root)
1511 22 8 if (exists $deps->{'line'}{$curr})
1516 14 28 unless ($iterself->{'seen'}{$succ}{$line}++)
1525 16 14 unless ($pushed)
1526 16 0 if (my(@path) = @{$iterself->{'path'};})
1527 8 8 if $opt->{'reverse_chains'}
1528 14 2 if (@path > 1) { }
1530 8 6 if ($self->{'lastpush'})
1537 0 2 if (defined $kind and $kind eq 'singleton')
1570 8 2 if (my(@it) = $self->{'it'}{'next'}->($self))
1595 0 9 unless defined $cache_directory
1597 0 9 if $file =~ /\.\./
1605 0 3 unless (defined $cache_directory)
1611 0 3 if (not 'File::Spec'->file_name_is_absolute($file) or $file =~ /\.\./ or not $file =~ /_p[ml](?:\Q$CACHE_EXT\E)?$/ || $file =~ /.p[ml]$/)
1619 1 2 $file =~ /\Q$CACHE_EXT\E$/ ? :
1623 0 3 unless ($self->looks_like_cache_file($cache_file))
1627 3 0 if ($self->{'opt'}{'cache_verbose'})
1630 2 1 if (unlink $cache_file)
1642 0 1 unless defined $cache_directory
1644 0 1 unless $cache_filename =~ s/\Q$CACHE_EXT\E$//
1647 0 1 unless length $cache_filename > $cache_prefix_length
1650 0 1 unless $prefix =~ m[^\Q$cache_directory\E(?:/|\\)$]
1656 0 1 if ($^O eq 'MSWin32')
1659 0 0 if ($path =~ m[^/([A-Z])(/.+)])
1661 0 0 if (-f $volpath)
1676 0 0 unless (defined $cache_directory)
1685 0 0 if (/\.p[ml]\Q$CACHE_EXT\E$/)
1703 0 0 if (/\.p[ml]$/)