| 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
| |||||||||||
| 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
| |||||||||||
| 19 | 21 | ▶ | next if !-s $pod_file; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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
| |||||||||||
| 24 | 1 | print "$pod_file\n"; | |||||||||
| 25 | 1 | $found++; | |||||||||
| 26 | 1 | last; | |||||||||
| 27 | } | ||||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | 1 | ▶ | if (!$found) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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__ | ||||||||||