bin/podpath

filter: Statementstmt 96.0% 24 / 25 Branchbran 70.0% 7 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 89.4% 34 / 38 CC 1 SCAR 0.0
CC
1
Cov
89%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« bin/podtoc ↑ Summary bin/basepods »
1 #!/usr/bin/env perl
2 # podpath - print the path to the Pod
3  
4 # ------ pragmas
5 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use pmtools;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 2 our $VERSION = '2.2.0';
10  
11 2 for my $module (@ARGV) {
12 2 ▶ if ( $module =~ /^perl/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($module =~ /^perl/) { } 1 1 2
13 1 system("$^X -S stdpods | grep $module");
14 } else {
15 1 $module =~ s#::#/#gmsx;
16 1 my $found = 0;
17 1 my $pod_iter = pmtools::new_pod_iterator($module);
18 1 ▶ while (my $pod_file = $pod_iter->()) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $pod_file = &$pod_iter()) 21 0 21
19 21 ▶ next if !-s $pod_file;
Branch: 1 branch
BranchTrueFalseTotal
unless -s $pod_file 20 1 21
20  
21 # in case we find the .pm before the .pod
22 1 my $output = `grep '=head1' $pod_file`;
23 1 ▶ if ($? == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($? == 0) 1 0 1
24 1 print "$pod_file\n";
25 1 $found++;
26 1 last;
27 }
28 }
29  
30 1 ▶ if (!$found) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($found) 0 1 1
31 0 print STDERR "$0: Can't locate $module.pm or $module.pod "
32 . "in \@INC (\@INC contains: " . join(' ', @INC) . ")\n";
33 }
34 }
35 }
36  
37 __END__
« bin/podtoc ↑ Summary bin/basepods »