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
22 namespace, so be sure to specify them in the use statement if you need
23 them:
24
25 use Pod::Find qw(pod_find);
26
27 From this version on the typical SCM (software configuration
28 management) files/directories like RCS, CVS, SCCS, .svn are ignored.
29
30 "pod_find( { %opts } , @directories )"
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
37 $HOME/perl5lib/MyModule.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"
68 environment as this is included in @INC by the Perl interpreter
69 itself.
70
71 "simplify_name( $str )"
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 Returns the location of a pod document given a search directory and a
78 module (e.g. "File::Find") or script (e.g. "perldoc") name.
79
80 Options:
81
82 "-inc => 1"
83 Search @INC for the pod and also the "scriptdir" defined in the
84 Config module.
85
86 "-dirs => [ $dir1, $dir2, ... ]"
87 Reference to an array of search directories. These are searched in
88 order before looking in @INC (if -inc). Current directory is used
89 if none are specified.
90
91 "-verbose => 1"
92 List directories as they are searched
93
94 Returns the full path of the first occurrence to the file. Package
95 names (eg 'A::B') are automatically converted to directory names in the
96 selected directory. (eg on unix 'A::B' is converted to 'A/B').
97 Additionally, '.pm', '.pl' and '.pod' are appended to the search
98 automatically if required.
99
100 A subdirectory pod/ is also checked if it exists in any of the given
101 search directories. This ensures that e.g. perlfunc is found.
102
103 It is assumed that if a module name is supplied, that that name matches
104 the file name. Pods are not opened to check for the 'NAME' entry.
105
106 A check is made to make sure that the file that is found does contain
107 some pod documentation.
108
109 "contains_pod( $file , $verbose )"
110 Returns true if the supplied filename (not POD module) contains some
111 pod information.
112
114 Please report bugs using <http://rt.cpan.org>.
115
116 Marek Rouchal <marekr@cpan.org>, heavily borrowing code from Nick
117 Ing-Simmons' PodToHtml.
118
119 Tim Jenness <t.jenness@jach.hawaii.edu> provided "pod_where" and
120 "contains_pod".
121
123 Pod::Parser, Pod::Checker, perldoc
124
125
126
127perl v5.12.4 2011-06-01 Pod::Find(3pm)