1Pod::Find(3pm) Perl Programmers Reference Guide Pod::Find(3pm)
2
3
4
6 Pod::Find - find POD documents in directory trees
7
9 use Pod::Find qw(pod_find simplify_name);
10 my %pods = pod_find({ -verbose => 1, -inc => 1 });
11 foreach(keys %pods) {
12 print "found library POD `$pods{$_}' in $_\n";
13 }
14
15 print "podname=",simplify_name('a/b/c/mymodule.pod'),"\n";
16
17 $location = pod_where( { -inc => 1 }, "Pod::Find" );
18
20 Pod::Find provides a set of functions to locate POD files. Note that
21 no function is exported by default to avoid pollution of your names‐
22 pace, so be sure to specify them in the use statement if you need them:
23
24 use Pod::Find qw(pod_find);
25
26 From this version on the typical SCM (software configuration manage‐
27 ment) files/directories like RCS, CVS, SCCS, .svn are ignored.
28
29 "pod_find( { %opts } , @directories )"
30
31 The function pod_find searches for POD documents in a given set of
32 files and/or directories. It returns a hash with the file names as keys
33 and the POD name as value. The POD name is derived from the file name
34 and its position in the directory tree.
35
36 E.g. when searching in $HOME/perl5lib, the file $HOME/perl5lib/MyMod‐
37 ule.pm would get the POD name MyModule, whereas
38 $HOME/perl5lib/Myclass/Subclass.pm would be Myclass::Subclass. The name
39 information can be used for POD translators.
40
41 Only text files containing at least one valid POD command are found.
42
43 A warning is printed if more than one POD file with the same POD name
44 is found, e.g. CPAN.pm in different directories. This usually indicates
45 duplicate occurrences of modules in the @INC search path.
46
47 OPTIONS The first argument for pod_find may be a hash reference with
48 options. The rest are either directories that are searched recursively
49 or files. The POD names of files are the plain basenames with any
50 Perl-like extension (.pm, .pl, .pod) stripped.
51
52 "-verbose => 1"
53 Print progress information while scanning.
54
55 "-perl => 1"
56 Apply Perl-specific heuristics to find the correct PODs. This
57 includes stripping Perl-like extensions, omitting subdirectories
58 that are numeric but do not match the current Perl interpreter's
59 version id, suppressing site_perl as a module hierarchy name etc.
60
61 "-script => 1"
62 Search for PODs in the current Perl interpreter's installation
63 scriptdir. This is taken from the local Config module.
64
65 "-inc => 1"
66 Search for PODs in the current Perl interpreter's @INC paths. This
67 automatically considers paths specified in the "PERL5LIB" environ‐
68 ment as this is prepended to @INC by the Perl interpreter itself.
69
70 "simplify_name( $str )"
71
72 The function simplify_name is equivalent to basename, but also strips
73 Perl-like extensions (.pm, .pl, .pod) and extensions like .bat, .cmd on
74 Win32 and OS/2, or .com on VMS, respectively.
75
76 "pod_where( { %opts }, $pod )"
77
78 Returns the location of a pod document given a search directory and a
79 module (e.g. "File::Find") or script (e.g. "perldoc") name.
80
81 Options:
82
83 "-inc => 1"
84 Search @INC for the pod and also the "scriptdir" defined in the
85 Config module.
86
87 "-dirs => [ $dir1, $dir2, ... ]"
88 Reference to an array of search directories. These are searched in
89 order before looking in @INC (if -inc). Current directory is used
90 if none are specified.
91
92 "-verbose => 1"
93 List directories as they are searched
94
95 Returns the full path of the first occurrence to the file. Package
96 names (eg 'A::B') are automatically converted to directory names in the
97 selected directory. (eg on unix 'A::B' is converted to 'A/B'). Addi‐
98 tionally, '.pm', '.pl' and '.pod' are appended to the search automati‐
99 cally if required.
100
101 A subdirectory pod/ is also checked if it exists in any of the given
102 search directories. This ensures that e.g. perlfunc is found.
103
104 It is assumed that if a module name is supplied, that that name matches
105 the file name. Pods are not opened to check for the 'NAME' entry.
106
107 A check is made to make sure that the file that is found does contain
108 some pod documentation.
109
110 "contains_pod( $file , $verbose )"
111
112 Returns true if the supplied filename (not POD module) contains some
113 pod information.
114
116 Please report bugs using <http://rt.cpan.org>.
117
118 Marek Rouchal <marekr@cpan.org>, heavily borrowing code from Nick
119 Ing-Simmons' PodToHtml.
120
121 Tim Jenness <t.jenness@jach.hawaii.edu> provided "pod_where" and "con‐
122 tains_pod".
123
125 Pod::Parser, Pod::Checker, perldoc
126
127
128
129perl v5.8.8 2001-09-21 Pod::Find(3pm)