This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade bignum from version 0.47 to 0.49
[perl5.git] / cpan / Pod-Perldoc / perldoc.pod
1
2 =head1 NAME
3
4 perldoc - Look up Perl documentation in Pod format.
5
6 =head1 SYNOPSIS
7
8     perldoc [-h] [-D] [-t] [-u] [-m] [-l] [-U] [-F]
9         [-i] [-V] [-T] [-r]
10         [-d destination_file]
11         [-o formatname]
12         [-M FormatterClassName]
13         [-w formatteroption:value]
14         [-n nroff-replacement]
15         [-X]
16         [-L language_code]
17         PageName|ModuleName|ProgramName|URL
18
19 Examples:
20
21     perldoc -f BuiltinFunction
22
23     perldoc -L it -f BuiltinFunction
24
25     perldoc -q FAQ Keyword
26
27     perldoc -L fr -q FAQ Keyword
28
29     perldoc -v PerlVariable
30
31     perldoc -a PerlAPI
32
33 See below for more description of the switches.
34
35 =head1 DESCRIPTION
36
37 B<perldoc> looks up documentation in .pod format that is embedded in the perl
38 installation tree or in a perl script, and displays it using a variety of
39 formatters.  This is primarily used for the documentation for the perl library
40 modules.
41
42 Your system may also have man pages installed for those modules, in
43 which case you can probably just use the man(1) command.
44
45 If you are looking for a table of contents to the Perl library modules
46 documentation, see the L<perltoc> page.
47
48 =head1 OPTIONS
49
50 =over 5
51
52 =item B<-h>
53
54 Prints out a brief B<h>elp message.
55
56 =item B<-D>
57
58 B<D>escribes search for the item in B<d>etail.
59
60 =item B<-t>
61
62 Display docs using plain B<t>ext converter, instead of nroff. This may be faster,
63 but it probably won't look as nice.
64
65 =item B<-u>
66
67 Skip the real Pod formatting, and just show the raw Pod source (B<U>nformatted)
68
69 =item B<-m> I<module>
70
71 Display the entire module: both code and unformatted pod documentation.
72 This may be useful if the docs don't explain a function in the detail
73 you need, and you'd like to inspect the code directly; perldoc will find
74 the file for you and simply hand it off for display.
75
76 =item B<-l>
77
78 Display onB<l>y the file name of the module found.
79
80 =item B<-U>
81
82 When running as the superuser, don't attempt drop privileges for security.
83 This option is implied with B<-F>.
84
85 B<NOTE>: Please see the heading SECURITY below for more information.
86
87 =item B<-F>
88
89 Consider arguments as file names; no search in directories will be performed.
90 Implies B<-U> if run as the superuser.
91
92 =item B<-f> I<perlfunc>
93
94 The B<-f> option followed by the name of a perl built-in function will
95 extract the documentation of this function from L<perlfunc>.
96
97 Example:
98
99       perldoc -f sprintf
100
101
102 =item B<-q> I<perlfaq-search-regexp>
103
104 The B<-q> option takes a regular expression as an argument.  It will search
105 the B<q>uestion headings in perlfaq[1-9] and print the entries matching
106 the regular expression.
107
108 Example:
109
110      perldoc -q shuffle
111
112 =item B<-a> I<perlapifunc>
113
114 The B<-a> option followed by the name of a perl api function will
115 extract the documentation of this function from L<perlapi>.
116
117 Example:
118
119      perldoc -a newHV
120
121 =item B<-v> I<perlvar>
122
123 The B<-v> option followed by the name of a Perl predefined variable will
124 extract the documentation of this variable from L<perlvar>.
125
126 Examples:
127
128      perldoc -v '$"'
129      perldoc -v @+
130      perldoc -v DATA
131
132
133 =item B<-T>
134
135 This specifies that the output is not to be sent to a pager, but is to
136 be sent directly to STDOUT.
137
138 =item B<-d> I<destination-filename>
139
140 This specifies that the output is to be sent neither to a pager nor
141 to STDOUT, but is to be saved to the specified filename.  Example:
142 C<perldoc -oLaTeX -dtextwrapdocs.tex Text::Wrap>
143
144 =item B<-o> I<output-formatname>
145
146 This specifies that you want Perldoc to try using a Pod-formatting
147 class for the output format that you specify.  For example:
148 C<-oman>.  This is actually just a wrapper around the C<-M> switch;
149 using C<-oI<formatname>> just looks for a loadable class by adding
150 that format name (with different capitalizations) to the end of
151 different classname prefixes.
152
153 For example, C<-oLaTeX> currently tries all of the following classes:
154 Pod::Perldoc::ToLaTeX Pod::Perldoc::Tolatex Pod::Perldoc::ToLatex
155 Pod::Perldoc::ToLATEX Pod::Simple::LaTeX Pod::Simple::latex
156 Pod::Simple::Latex Pod::Simple::LATEX Pod::LaTeX Pod::latex Pod::Latex
157 Pod::LATEX.
158
159 =item B<-M> I<module-name>
160
161 This specifies the module that you want to try using for formatting the
162 pod.  The class must at least provide a C<parse_from_file> method.
163 For example: C<perldoc -MPod::Perldoc::ToChecker>.
164
165 You can specify several classes to try by joining them with commas
166 or semicolons, as in C<-MTk::SuperPod;Tk::Pod>.
167
168 =item B<-w> I<option:value> or B<-w> I<option>
169
170 This specifies an option to call the formatter B<w>ith.  For example,
171 C<-w textsize:15> will call
172 C<< $formatter->textsize(15) >> on the formatter object before it is
173 used to format the object.  For this to be valid, the formatter class
174 must provide such a method, and the value you pass should be valid.
175 (So if C<textsize> expects an integer, and you do C<-w textsize:big>,
176 expect trouble.)
177
178 You can use C<-w optionname> (without a value) as shorthand for
179 C<-w optionname:I<TRUE>>.  This is presumably useful in cases of on/off
180 features like: C<-w page_numbering>.
181
182 You can use an "=" instead of the ":", as in: C<-w textsize=15>.  This
183 might be more (or less) convenient, depending on what shell you use.
184
185 =item B<-X>
186
187 Use an index if it is present. The B<-X> option looks for an entry
188 whose basename matches the name given on the command line in the file
189 C<$Config{archlib}/pod.idx>. The F<pod.idx> file should contain fully
190 qualified filenames, one per line.
191
192 =item B<-L> I<language_code>
193
194 This allows one to specify the I<language code> for the desired language
195 translation. If the C<POD2::E<lt>language_codeE<gt>> package isn't
196 installed in your system, the switch is ignored.
197 All available translation packages are to be found under the C<POD2::>
198 namespace. See L<POD2::IT> (or L<POD2::FR>) to see how to create new
199 localized C<POD2::*> documentation packages and integrate them into
200 L<Pod::Perldoc>.
201
202 =item B<PageName|ModuleName|ProgramName|URL>
203
204 The item you want to look up.  Nested modules (such as C<File::Basename>)
205 are specified either as C<File::Basename> or C<< File/Basename >>.  You may also
206 give a descriptive name of a page, such as C<perlfunc>.  For URLs, HTTP and
207 HTTPS are the only kind currently supported.
208
209 For simple names like 'foo', when the normal search fails to find
210 a matching page, a search with the "perl" prefix is tried as well.
211 So "perldoc intro" is enough to find/render "perlintro.pod".
212
213 =item B<-n> I<some-formatter>
214
215 Specify replacement for groff
216
217 =item B<-r>
218
219 Recursive search.
220
221 =item B<-i>
222
223 Ignore case.
224
225 =item B<-V>
226
227 Displays the version of perldoc you're running.
228
229 =back
230
231 =head1 SECURITY
232
233 Because B<perldoc> does not run properly tainted, and is known to
234 have security issues, when run as the superuser it will attempt to
235 drop privileges by setting the effective and real IDs to nobody's
236 or nouser's account, or -2 if unavailable.  If it cannot relinquish
237 its privileges, it will not run.
238
239 See the C<-U> option if you do not want this behavior but B<beware>
240 that there are significant security risks if you choose to use C<-U>.
241
242 Since 3.26, using C<-F> as the superuser also implies C<-U> as opening
243 most files and traversing directories requires privileges that are
244 above the nobody/nogroup level.
245
246 =head1 ENVIRONMENT
247
248 Any switches in the C<PERLDOC> environment variable will be used before the
249 command line arguments.
250
251 Useful values for C<PERLDOC> include C<-oterm>, C<-otext>, C<-ortf>,
252 C<-oxml>, and so on, depending on what modules you have on hand; or
253 the formatter class may be specified exactly with C<-MPod::Perldoc::ToTerm>
254 or the like.
255
256 C<perldoc> also searches directories
257 specified by the C<PERL5LIB> (or C<PERLLIB> if C<PERL5LIB> is not
258 defined) and C<PATH> environment variables.
259 (The latter is so that embedded pods for executables, such as
260 C<perldoc> itself, are available.)
261
262 In directories where either C<Makefile.PL> or C<Build.PL> exist, C<perldoc>
263 will add C<.> and C<lib> first to its search path, and as long as you're not
264 the superuser will add C<blib> too.  This is really helpful if you're working
265 inside of a build directory and want to read through the docs even if you
266 have a version of a module previously installed.
267
268 C<perldoc> will use, in order of preference, the pager defined in
269 C<PERLDOC_PAGER>, C<MANPAGER>, or C<PAGER> before trying to find a pager
270 on its own. (C<MANPAGER> is not used if C<perldoc> was told to display
271 plain text or unformatted pod.)
272
273 When using perldoc in it's C<-m> mode (display module source code),
274 C<perldoc> will attempt to use the pager set in C<PERLDOC_SRC_PAGER>.
275 A useful setting for this command is your favorite editor as in
276 C</usr/bin/nano>. (Don't judge me.)
277
278 One useful value for C<PERLDOC_PAGER> is C<less -+C -E>.
279
280 Having PERLDOCDEBUG set to a positive integer will make perldoc emit
281 even more descriptive output than the C<-D> switch does; the higher the
282 number, the more it emits.
283
284
285 =head1 CHANGES
286
287 Up to 3.14_05, the switch B<-v> was used to produce verbose
288 messages of B<perldoc> operation, which is now enabled by B<-D>.
289
290 =head1 SEE ALSO
291
292 L<perlpod>, L<Pod::Perldoc>
293
294 =head1 AUTHOR
295
296 Current maintainer: Mark Allen C<< <mallen@cpan.org> >>
297
298 Past contributors are:
299 brian d foy C<< <bdfoy@cpan.org> >> 
300 Adriano R. Ferreira C<< <ferreira@cpan.org> >>,
301 Sean M. Burke C<< <sburke@cpan.org> >>,
302 Kenneth Albanowski C<< <kjahds@kjahds.com> >>,
303 Andy Dougherty  C<< <doughera@lafcol.lafayette.edu> >>,
304 and many others.
305
306 =cut