File Coverage

blib/lib/pmtools.pm
Criterion Covered Total %
statement 18 18 100.0
branch 2 2 100.0
condition n/a
subroutine 4 4 100.0
pod 0 1 0.0
total 24 25 96.0


line stmt bran cond sub pod time code
1             package pmtools;
2              
3 1     1   622 use strict;
  1         2  
  1         26  
4 1     1   4 use warnings;
  1         1  
  1         224  
5              
6             our $VERSION = '2.0.0';
7              
8             sub new_pod_iterator {
9 1     1 0 9 my ($module) = @_; # module name
10              
11 1         1 my $index = 0; # index of all possible POD files
12 1         2 my $inc_index = 0; # index into @INC
13 1         3 my $pod_index = 0; # index into @pods
14 1         4 my @pods = ( # list of possible POD files given an @INC directory
15             "pod/$module.pod",
16             "$module.pod",
17             "$module.pm",
18             );
19              
20             return sub {
21 35 100   35   1333 if ($index >= scalar @INC * scalar @pods) {
22 2         7 return undef;
23             }
24              
25 33         43 $inc_index = $index / scalar @pods;
26 33         39 $pod_index = $index % scalar @pods;
27 33         35 $index++;
28              
29 33         109 return "$INC[$inc_index]/$pods[$pod_index]";
30 1         9 };
31             }
32              
33             1;
34              
35              
36             # ------ From Tom Christiansen's original README file for pmtools:
37             # This is pmtools -- a suite of small programs to help manage modules.
38             # The names are totally preliminary, and in fact, so is the code. We follow
39             # the "keep it small" notion of many tiny tools each doing one thing well,
40             # eschewing giant megatools with millions of options.
41             #
42             # Tom Christiansen
43             # tchrist@perl.com
44              
45             =head1 NAME
46              
47             pmtools - Perl Module Tools
48              
49             =head1 SYNOPSIS
50              
51             pmdesc module ...
52             pmpath module ...
53             pmvers module ...
54             ...
55             sitepods
56             ...
57              
58             =head1 DESCRIPTION
59              
60             Perl Modules Tools (pmtools) is a suite of tools designed
61             originally by Tom Christiansen.
62              
63             For each module name given as an argument, produces its full path on
64             the standard output, one per line.
65              
66             =head1 EXAMPLES
67              
68             $ pmpath CGI
69             /usr/local/devperl/lib/5.00554/CGI.pm
70              
71             $ filsperl -S pmpath IO::Socket CGI::Carp
72             /usr/local/filsperl/lib/5.00554/i686-linux-thread/IO/Socket.pm
73             /usr/local/filsperl/lib/5.00554/CGI/Carp.pm
74              
75             $ oldperl -S pmpath CGI CGI::Imagemap
76             /usr/lib/perl5/CGI.pm
77             /usr/lib/perl5/site_perl/CGI/Imagemap.pm
78              
79             =head1 SEE ALSO
80              
81             pmdesc(1),
82             pmvers(1),
83             pmcat(1).
84              
85             =head1 AUTHORS and COPYRIGHTS
86              
87             Copyright (C) 1999 Tom Christiansen.
88              
89             Copyright (C) 2006-2014 Mark Leighton Fisher.
90              
91             =head1 LICENSE
92              
93             This is free software; you can redistribute it and/or modify it
94             under the terms of either:
95             (a) the GNU General Public License as published by the Free
96             Software Foundation; either version 1, or (at your option) any
97             later version, or
98             (b) the Perl "Artistic License".
99             (This is the Perl 5 licensing scheme.)
100              
101             Please note this is a change from the
102             original pmtools-1.00 (still available on CPAN),
103             as pmtools-1.00 were licensed only under the
104             Perl "Artistic License".