xref: /openbsd-src/gnu/usr.bin/perl/cpan/Pod-Perldoc/perldoc.pod (revision 5759b3d249badf144a6240f7eec4dcf9df003e6b)
16fb12b70Safresh1
26fb12b70Safresh1=head1 NAME
36fb12b70Safresh1
46fb12b70Safresh1perldoc - Look up Perl documentation in Pod format.
56fb12b70Safresh1
66fb12b70Safresh1=head1 SYNOPSIS
76fb12b70Safresh1
8*5759b3d2Safresh1    perldoc [-h] [-D] [-t] [-u] [-m] [-l] [-U] [-F]
96fb12b70Safresh1        [-i] [-V] [-T] [-r]
106fb12b70Safresh1        [-d destination_file]
116fb12b70Safresh1        [-o formatname]
126fb12b70Safresh1        [-M FormatterClassName]
136fb12b70Safresh1        [-w formatteroption:value]
146fb12b70Safresh1        [-n nroff-replacement]
156fb12b70Safresh1        [-X]
166fb12b70Safresh1        [-L language_code]
176fb12b70Safresh1        PageName|ModuleName|ProgramName|URL
186fb12b70Safresh1
196fb12b70Safresh1Examples:
206fb12b70Safresh1
216fb12b70Safresh1    perldoc -f BuiltinFunction
226fb12b70Safresh1
236fb12b70Safresh1    perldoc -L it -f BuiltinFunction
246fb12b70Safresh1
256fb12b70Safresh1    perldoc -q FAQ Keyword
266fb12b70Safresh1
276fb12b70Safresh1    perldoc -L fr -q FAQ Keyword
286fb12b70Safresh1
296fb12b70Safresh1    perldoc -v PerlVariable
306fb12b70Safresh1
316fb12b70Safresh1    perldoc -a PerlAPI
326fb12b70Safresh1
336fb12b70Safresh1See below for more description of the switches.
346fb12b70Safresh1
356fb12b70Safresh1=head1 DESCRIPTION
366fb12b70Safresh1
37*5759b3d2Safresh1B<perldoc> looks up documentation in .pod format that is embedded in the perl
38*5759b3d2Safresh1installation tree or in a perl script, and displays it using a variety of
39*5759b3d2Safresh1formatters.  This is primarily used for the documentation for the perl library
40*5759b3d2Safresh1modules.
416fb12b70Safresh1
426fb12b70Safresh1Your system may also have man pages installed for those modules, in
436fb12b70Safresh1which case you can probably just use the man(1) command.
446fb12b70Safresh1
456fb12b70Safresh1If you are looking for a table of contents to the Perl library modules
466fb12b70Safresh1documentation, see the L<perltoc> page.
476fb12b70Safresh1
486fb12b70Safresh1=head1 OPTIONS
496fb12b70Safresh1
506fb12b70Safresh1=over 5
516fb12b70Safresh1
526fb12b70Safresh1=item B<-h>
536fb12b70Safresh1
546fb12b70Safresh1Prints out a brief B<h>elp message.
556fb12b70Safresh1
566fb12b70Safresh1=item B<-D>
576fb12b70Safresh1
586fb12b70Safresh1B<D>escribes search for the item in B<d>etail.
596fb12b70Safresh1
606fb12b70Safresh1=item B<-t>
616fb12b70Safresh1
626fb12b70Safresh1Display docs using plain B<t>ext converter, instead of nroff. This may be faster,
636fb12b70Safresh1but it probably won't look as nice.
646fb12b70Safresh1
656fb12b70Safresh1=item B<-u>
666fb12b70Safresh1
676fb12b70Safresh1Skip the real Pod formatting, and just show the raw Pod source (B<U>nformatted)
686fb12b70Safresh1
696fb12b70Safresh1=item B<-m> I<module>
706fb12b70Safresh1
716fb12b70Safresh1Display the entire module: both code and unformatted pod documentation.
726fb12b70Safresh1This may be useful if the docs don't explain a function in the detail
736fb12b70Safresh1you need, and you'd like to inspect the code directly; perldoc will find
746fb12b70Safresh1the file for you and simply hand it off for display.
756fb12b70Safresh1
766fb12b70Safresh1=item B<-l>
776fb12b70Safresh1
786fb12b70Safresh1Display onB<l>y the file name of the module found.
796fb12b70Safresh1
80*5759b3d2Safresh1=item B<-U>
81*5759b3d2Safresh1
82*5759b3d2Safresh1When running as the superuser, don't attempt drop privileges for security.
83*5759b3d2Safresh1This option is implied with B<-F>.
84*5759b3d2Safresh1
85*5759b3d2Safresh1B<NOTE>: Please see the heading SECURITY below for more information.
86*5759b3d2Safresh1
876fb12b70Safresh1=item B<-F>
886fb12b70Safresh1
896fb12b70Safresh1Consider arguments as file names; no search in directories will be performed.
90*5759b3d2Safresh1Implies B<-U> if run as the superuser.
916fb12b70Safresh1
926fb12b70Safresh1=item B<-f> I<perlfunc>
936fb12b70Safresh1
946fb12b70Safresh1The B<-f> option followed by the name of a perl built-in function will
956fb12b70Safresh1extract the documentation of this function from L<perlfunc>.
966fb12b70Safresh1
976fb12b70Safresh1Example:
986fb12b70Safresh1
996fb12b70Safresh1      perldoc -f sprintf
1006fb12b70Safresh1
1016fb12b70Safresh1
1026fb12b70Safresh1=item B<-q> I<perlfaq-search-regexp>
1036fb12b70Safresh1
1046fb12b70Safresh1The B<-q> option takes a regular expression as an argument.  It will search
1056fb12b70Safresh1the B<q>uestion headings in perlfaq[1-9] and print the entries matching
1066fb12b70Safresh1the regular expression.
1076fb12b70Safresh1
1086fb12b70Safresh1Example:
1096fb12b70Safresh1
1106fb12b70Safresh1     perldoc -q shuffle
1116fb12b70Safresh1
1126fb12b70Safresh1=item B<-a> I<perlapifunc>
1136fb12b70Safresh1
1146fb12b70Safresh1The B<-a> option followed by the name of a perl api function will
1156fb12b70Safresh1extract the documentation of this function from L<perlapi>.
1166fb12b70Safresh1
1176fb12b70Safresh1Example:
1186fb12b70Safresh1
1196fb12b70Safresh1     perldoc -a newHV
1206fb12b70Safresh1
1216fb12b70Safresh1=item B<-v> I<perlvar>
1226fb12b70Safresh1
1236fb12b70Safresh1The B<-v> option followed by the name of a Perl predefined variable will
1246fb12b70Safresh1extract the documentation of this variable from L<perlvar>.
1256fb12b70Safresh1
1266fb12b70Safresh1Examples:
1276fb12b70Safresh1
1286fb12b70Safresh1     perldoc -v '$"'
1296fb12b70Safresh1     perldoc -v @+
1306fb12b70Safresh1     perldoc -v DATA
1316fb12b70Safresh1
1326fb12b70Safresh1
1336fb12b70Safresh1=item B<-T>
1346fb12b70Safresh1
1356fb12b70Safresh1This specifies that the output is not to be sent to a pager, but is to
1366fb12b70Safresh1be sent directly to STDOUT.
1376fb12b70Safresh1
1386fb12b70Safresh1=item B<-d> I<destination-filename>
1396fb12b70Safresh1
1406fb12b70Safresh1This specifies that the output is to be sent neither to a pager nor
1416fb12b70Safresh1to STDOUT, but is to be saved to the specified filename.  Example:
1426fb12b70Safresh1C<perldoc -oLaTeX -dtextwrapdocs.tex Text::Wrap>
1436fb12b70Safresh1
1446fb12b70Safresh1=item B<-o> I<output-formatname>
1456fb12b70Safresh1
1466fb12b70Safresh1This specifies that you want Perldoc to try using a Pod-formatting
1476fb12b70Safresh1class for the output format that you specify.  For example:
1486fb12b70Safresh1C<-oman>.  This is actually just a wrapper around the C<-M> switch;
1496fb12b70Safresh1using C<-oI<formatname>> just looks for a loadable class by adding
1506fb12b70Safresh1that format name (with different capitalizations) to the end of
1516fb12b70Safresh1different classname prefixes.
1526fb12b70Safresh1
1536fb12b70Safresh1For example, C<-oLaTeX> currently tries all of the following classes:
1546fb12b70Safresh1Pod::Perldoc::ToLaTeX Pod::Perldoc::Tolatex Pod::Perldoc::ToLatex
1556fb12b70Safresh1Pod::Perldoc::ToLATEX Pod::Simple::LaTeX Pod::Simple::latex
1566fb12b70Safresh1Pod::Simple::Latex Pod::Simple::LATEX Pod::LaTeX Pod::latex Pod::Latex
1576fb12b70Safresh1Pod::LATEX.
1586fb12b70Safresh1
1596fb12b70Safresh1=item B<-M> I<module-name>
1606fb12b70Safresh1
1616fb12b70Safresh1This specifies the module that you want to try using for formatting the
1626fb12b70Safresh1pod.  The class must at least provide a C<parse_from_file> method.
1636fb12b70Safresh1For example: C<perldoc -MPod::Perldoc::ToChecker>.
1646fb12b70Safresh1
1656fb12b70Safresh1You can specify several classes to try by joining them with commas
1666fb12b70Safresh1or semicolons, as in C<-MTk::SuperPod;Tk::Pod>.
1676fb12b70Safresh1
1686fb12b70Safresh1=item B<-w> I<option:value> or B<-w> I<option>
1696fb12b70Safresh1
1706fb12b70Safresh1This specifies an option to call the formatter B<w>ith.  For example,
1716fb12b70Safresh1C<-w textsize:15> will call
1726fb12b70Safresh1C<< $formatter->textsize(15) >> on the formatter object before it is
1736fb12b70Safresh1used to format the object.  For this to be valid, the formatter class
1746fb12b70Safresh1must provide such a method, and the value you pass should be valid.
1756fb12b70Safresh1(So if C<textsize> expects an integer, and you do C<-w textsize:big>,
1766fb12b70Safresh1expect trouble.)
1776fb12b70Safresh1
1786fb12b70Safresh1You can use C<-w optionname> (without a value) as shorthand for
1796fb12b70Safresh1C<-w optionname:I<TRUE>>.  This is presumably useful in cases of on/off
1806fb12b70Safresh1features like: C<-w page_numbering>.
1816fb12b70Safresh1
1826fb12b70Safresh1You can use an "=" instead of the ":", as in: C<-w textsize=15>.  This
1836fb12b70Safresh1might be more (or less) convenient, depending on what shell you use.
1846fb12b70Safresh1
1856fb12b70Safresh1=item B<-X>
1866fb12b70Safresh1
1876fb12b70Safresh1Use an index if it is present. The B<-X> option looks for an entry
1886fb12b70Safresh1whose basename matches the name given on the command line in the file
1896fb12b70Safresh1C<$Config{archlib}/pod.idx>. The F<pod.idx> file should contain fully
1906fb12b70Safresh1qualified filenames, one per line.
1916fb12b70Safresh1
1926fb12b70Safresh1=item B<-L> I<language_code>
1936fb12b70Safresh1
1946fb12b70Safresh1This allows one to specify the I<language code> for the desired language
1956fb12b70Safresh1translation. If the C<POD2::E<lt>language_codeE<gt>> package isn't
1966fb12b70Safresh1installed in your system, the switch is ignored.
1976fb12b70Safresh1All available translation packages are to be found under the C<POD2::>
1986fb12b70Safresh1namespace. See L<POD2::IT> (or L<POD2::FR>) to see how to create new
1996fb12b70Safresh1localized C<POD2::*> documentation packages and integrate them into
2006fb12b70Safresh1L<Pod::Perldoc>.
2016fb12b70Safresh1
2026fb12b70Safresh1=item B<PageName|ModuleName|ProgramName|URL>
2036fb12b70Safresh1
2046fb12b70Safresh1The item you want to look up.  Nested modules (such as C<File::Basename>)
2056fb12b70Safresh1are specified either as C<File::Basename> or C<< File/Basename >>.  You may also
2066fb12b70Safresh1give a descriptive name of a page, such as C<perlfunc>.  For URLs, HTTP and
2076fb12b70Safresh1HTTPS are the only kind currently supported.
2086fb12b70Safresh1
2096fb12b70Safresh1For simple names like 'foo', when the normal search fails to find
2106fb12b70Safresh1a matching page, a search with the "perl" prefix is tried as well.
2116fb12b70Safresh1So "perldoc intro" is enough to find/render "perlintro.pod".
2126fb12b70Safresh1
2136fb12b70Safresh1=item B<-n> I<some-formatter>
2146fb12b70Safresh1
2156fb12b70Safresh1Specify replacement for groff
2166fb12b70Safresh1
2176fb12b70Safresh1=item B<-r>
2186fb12b70Safresh1
2196fb12b70Safresh1Recursive search.
2206fb12b70Safresh1
2216fb12b70Safresh1=item B<-i>
2226fb12b70Safresh1
2236fb12b70Safresh1Ignore case.
2246fb12b70Safresh1
2256fb12b70Safresh1=item B<-V>
2266fb12b70Safresh1
2276fb12b70Safresh1Displays the version of perldoc you're running.
2286fb12b70Safresh1
2296fb12b70Safresh1=back
2306fb12b70Safresh1
2316fb12b70Safresh1=head1 SECURITY
2326fb12b70Safresh1
2336fb12b70Safresh1Because B<perldoc> does not run properly tainted, and is known to
2346fb12b70Safresh1have security issues, when run as the superuser it will attempt to
2356fb12b70Safresh1drop privileges by setting the effective and real IDs to nobody's
2366fb12b70Safresh1or nouser's account, or -2 if unavailable.  If it cannot relinquish
2376fb12b70Safresh1its privileges, it will not run.
2386fb12b70Safresh1
239*5759b3d2Safresh1See the C<-U> option if you do not want this behavior but B<beware>
240*5759b3d2Safresh1that there are significant security risks if you choose to use C<-U>.
241*5759b3d2Safresh1
242*5759b3d2Safresh1Since 3.26, using C<-F> as the superuser also implies C<-U> as opening
243*5759b3d2Safresh1most files and traversing directories requires privileges that are
244*5759b3d2Safresh1above the nobody/nogroup level.
245*5759b3d2Safresh1
2466fb12b70Safresh1=head1 ENVIRONMENT
2476fb12b70Safresh1
2486fb12b70Safresh1Any switches in the C<PERLDOC> environment variable will be used before the
2496fb12b70Safresh1command line arguments.
2506fb12b70Safresh1
2516fb12b70Safresh1Useful values for C<PERLDOC> include C<-oterm>, C<-otext>, C<-ortf>,
2526fb12b70Safresh1C<-oxml>, and so on, depending on what modules you have on hand; or
2536fb12b70Safresh1the formatter class may be specified exactly with C<-MPod::Perldoc::ToTerm>
2546fb12b70Safresh1or the like.
2556fb12b70Safresh1
2566fb12b70Safresh1C<perldoc> also searches directories
2576fb12b70Safresh1specified by the C<PERL5LIB> (or C<PERLLIB> if C<PERL5LIB> is not
2586fb12b70Safresh1defined) and C<PATH> environment variables.
2596fb12b70Safresh1(The latter is so that embedded pods for executables, such as
2606fb12b70Safresh1C<perldoc> itself, are available.)
2616fb12b70Safresh1
2626fb12b70Safresh1In directories where either C<Makefile.PL> or C<Build.PL> exist, C<perldoc>
2636fb12b70Safresh1will add C<.> and C<lib> first to its search path, and as long as you're not
2646fb12b70Safresh1the superuser will add C<blib> too.  This is really helpful if you're working
2656fb12b70Safresh1inside of a build directory and want to read through the docs even if you
2666fb12b70Safresh1have a version of a module previously installed.
2676fb12b70Safresh1
2686fb12b70Safresh1C<perldoc> will use, in order of preference, the pager defined in
2696fb12b70Safresh1C<PERLDOC_PAGER>, C<MANPAGER>, or C<PAGER> before trying to find a pager
2706fb12b70Safresh1on its own. (C<MANPAGER> is not used if C<perldoc> was told to display
2716fb12b70Safresh1plain text or unformatted pod.)
2726fb12b70Safresh1
2736fb12b70Safresh1When using perldoc in it's C<-m> mode (display module source code),
2746fb12b70Safresh1C<perldoc> will attempt to use the pager set in C<PERLDOC_SRC_PAGER>.
2756fb12b70Safresh1A useful setting for this command is your favorite editor as in
2766fb12b70Safresh1C</usr/bin/nano>. (Don't judge me.)
2776fb12b70Safresh1
2786fb12b70Safresh1One useful value for C<PERLDOC_PAGER> is C<less -+C -E>.
2796fb12b70Safresh1
2806fb12b70Safresh1Having PERLDOCDEBUG set to a positive integer will make perldoc emit
2816fb12b70Safresh1even more descriptive output than the C<-D> switch does; the higher the
2826fb12b70Safresh1number, the more it emits.
2836fb12b70Safresh1
2846fb12b70Safresh1
2856fb12b70Safresh1=head1 CHANGES
2866fb12b70Safresh1
2876fb12b70Safresh1Up to 3.14_05, the switch B<-v> was used to produce verbose
2886fb12b70Safresh1messages of B<perldoc> operation, which is now enabled by B<-D>.
2896fb12b70Safresh1
2906fb12b70Safresh1=head1 SEE ALSO
2916fb12b70Safresh1
2926fb12b70Safresh1L<perlpod>, L<Pod::Perldoc>
2936fb12b70Safresh1
2946fb12b70Safresh1=head1 AUTHOR
2956fb12b70Safresh1
2966fb12b70Safresh1Current maintainer: Mark Allen C<< <mallen@cpan.org> >>
2976fb12b70Safresh1
2986fb12b70Safresh1Past contributors are:
2996fb12b70Safresh1brian d foy C<< <bdfoy@cpan.org> >>
3006fb12b70Safresh1Adriano R. Ferreira C<< <ferreira@cpan.org> >>,
3016fb12b70Safresh1Sean M. Burke C<< <sburke@cpan.org> >>,
3026fb12b70Safresh1Kenneth Albanowski C<< <kjahds@kjahds.com> >>,
3036fb12b70Safresh1Andy Dougherty  C<< <doughera@lafcol.lafayette.edu> >>,
3046fb12b70Safresh1and many others.
3056fb12b70Safresh1
3066fb12b70Safresh1=cut
307