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