MAN page from PCLinuxOS perl-podlators-4.70.0-3pclos2017.noarch.rpm


Section: User Contributed Perl Documentation (3)
Updated: 2016-03-20


Pod::Man - Convert POD data to formatted *roff input 


    use Pod::Man;    my $parser = Pod::Man->new (release => $VERSION, section => 8);    # Read POD from STDIN and write to STDOUT.    $parser->parse_file (\*STDIN);    # Read POD from file.pod and write to file.1.    $parser->parse_from_file ('file.pod', 'file.1');


Pod::Man is a module to convert documentation in the POD format (thepreferred language for documenting Perl) into *roff input using the manmacro set. The resulting *roff code is suitable for display on a terminalusing nroff(1), normally via man(1), or printing using troff(1).It is conventionally invoked using the driver script pod2man, but it canalso be used directly.

As a derived class from Pod::Simple, Pod::Man supports the same methods andinterfaces. See Pod::Simple for all the details.

new() can take options, in the form of key/value pairs that control thebehavior of the parser. See below for details.

If no options are given, Pod::Man uses the name of the input file with anytrailing ".pod", ".pm", or ".pl" stripped as the man page title, tosection 1 unless the file ended in ".pm" in which case it defaults tosection 3, to a centered title of ``User Contributed Perl Documentation'', toa centered footer of the Perl version it is run with, and to a left-handfooter of the modification date of its input (or the current date if given"STDIN" for input).

Pod::Man assumes that your *roff formatters have a fixed-width font named"CW". If yours is called something else (like "CR"), use the "fixed"option to specify it. This generally only matters for troff output forprinting. Similarly, you can set the fonts used for bold, italic, andbold italic fixed-width output.

Besides the obvious pod conversions, Pod::Man also takes care offormatting func(), func(3), and simple variable references like $foo or@bar so you don't have to use code escapes for them; complex expressionslike $fred{'stuff'} will still need to be escaped, though. It alsotranslates dashes that aren't used as hyphens into en dashes, makes longdashes---like this---into proper em dashes, fixes ``paired quotes,'' makes C++look right, puts a little space between double underscores, makes ALLCAPSa teeny bit smaller in troff, and escapes stuff that *roff treats asspecial so that you don't have to.

The recognized options to new() are as follows. All options take a singleargument.

Sets the centered page header for the ".TH" macro. The default, if thisoption is not specified, is ``User Contributed Perl Documentation''.
Sets the left-hand footer for the ".TH" macro. If this option is not set,the contents of the environment variable POD_MAN_DATE, if set, will be used.Failing that, the value of SOURCE_DATE_EPOCH, the modification date of theinput file, or the current time if stat() can't find that file (which will bethe case if the input is from "STDIN") will be used. If obtained from thefile modification date or the current time, the date will be formatted as"YYYY-MM-DD" and will be based on UTC (so that the output will bereproducible regardless of local time zone).
How to report errors. "die" says to throw an exception on any PODformatting error. "stderr" says to report errors on standard error, butnot to throw an exception. "pod" says to include a POD ERRORS sectionin the resulting documentation summarizing the errors. "none" ignoresPOD errors entirely, as much as possible.

The default is "pod".

The fixed-width font to use for verbatim text and code. Defaults to"CW". Some systems may want "CR" instead. Only matters for troffoutput.
Bold version of the fixed-width font. Defaults to "CB". Only mattersfor troff output.
Italic version of the fixed-width font (actually, something of a misnomer,since most fixed-width fonts only have an oblique version, not an italicversion). Defaults to "CI". Only matters for troff output.
Bold italic (probably actually oblique) version of the fixed-width font.Pod::Man doesn't assume you have this, and defaults to "CB". Somesystems (such as Solaris) have this font available as "CX". Only mattersfor troff output.
Set the name of the manual page for the ".TH" macro. Without thisoption, the manual name is set to the uppercased base name of the filebeing converted unless the manual section is 3, in which case the path isparsed to see if it is a Perl module path. If it is, a path like".../lib/Pod/" is converted into a name like "Pod::Man". Thisoption, if given, overrides any automatic determination of the name.

If generating a manual page from standard input, this option is required,since there's otherwise no way for Pod::Man to know what to use for themanual page name.

Normally, L<> formatting codes with a URL but anchor text are formattedto show both the anchor text and the URL. In other words:


is formatted as:

    foo <>

This option, if set to a true value, suppresses the URL when anchor textis given, so this example would be formatted as just "foo". This canproduce less cluttered output in cases where the URLs are not particularlyimportant.

Sets the quote marks used to surround C<> text. If the value is asingle character, it is used as both the left and right quote. Otherwise,it is split in half, and the first half of the string is used as the leftquote and the second is used as the right quote.

This may also be set to the special value "none", in which case no quotemarks are added around C<> text (but the font is still changed for troffoutput).

Set the centered footer for the ".TH" macro. By default, this is set tothe version of Perl you run Pod::Man under. Setting this to the emptystring will cause some *roff implementations to use the system defaultvalue.

Note that some system "an" macro sets assume that the centered footerwill be a modification date and will prepend something like ``Lastmodified: ''. If this is the case for your target system, you may want toset "release" to the last modified date and "date" to the versionnumber.

Set the section for the ".TH" macro. The standard section numberingconvention is to use 1 for user commands, 2 for system calls, 3 forfunctions, 4 for devices, 5 for file formats, 6 for games, 7 formiscellaneous information, and 8 for administrator commands. There is a lotof variation here, however; some systems (like Solaris) use 4 for fileformats, 5 for miscellaneous information, and 7 for devices. Still othersuse 1m instead of 8, or some mix of both. About the only section numbersthat are reliably consistent are 1, 2, and 3.

By default, section 1 will be used unless the file ends in ".pm" in whichcase section 3 will be selected.

Send error messages about invalid POD to standard error instead ofappending a POD ERRORS section to the generated *roff output. This isequivalent to setting "errors" to "stderr" if "errors" is not alreadyset. It is supported for backward compatibility.
By default, Pod::Man produces the most conservative possible *roff outputto try to ensure that it will work with as many different *roffimplementations as possible. Many *roff implementations cannot handlenon-ASCII characters, so this means all non-ASCII characters are convertedeither to a *roff escape sequence that tries to create a properly accentedcharacter (at least for troff output) or to "X".

If this option is set, Pod::Man will instead output UTF-8. If your *roffimplementation can handle it, this is the best output format to use andavoids corruption of documents containing non-ASCII characters. However,be warned that *roff source with literal UTF-8 characters is not supportedby many implementations and may even result in segfaults and other badbehavior.

Be aware that, when using this option, the input encoding of your PODsource should be properly declared unless it's US-ASCII. Pod::Simple willattempt to guess the encoding and may be successful if it's Latin-1 orUTF-8, but it will produce warnings. Use the "=encoding" command todeclare the encoding. See perlpod(1) for more information.

The standard Pod::Simple method parse_file() takes one argument naming thePOD file to read from. By default, the output is sent to "STDOUT", butthis can be changed with the output_fh() method.

The standard Pod::Simple method parse_from_file() takes up to twoarguments, the first being the input file to read POD from and the secondbeing the file to write the formatted output to.

You can also call parse_lines() to parse an array of lines orparse_string_document() to parse a document already in memory. As withparse_file(), parse_lines() and parse_string_document() default to sendingtheir output to "STDOUT" unless changed with the output_fh() method.

To put the output from any parse method into a string instead of a filehandle, call the output_string() method instead of output_fh().

See Pod::Simple for more specific details on the methods available toall derived parsers. 


roff font should be 1 or 2 chars, not %s
(F) You specified a *roff font (using "fixed", "fixedbold", etc.) thatwasn't either one or two characters. Pod::Man doesn't support *roff fontslonger than two characters, although some *roff extensions do (thecanonical versions of nroff and troff don't either).
Invalid errors setting %s
(F) The "errors" parameter to the constructor was set to an unknown value.
Invalid quote specification %s
(F) The quote specification given (the "quotes" option to theconstructor) was invalid. A quote specification must be either onecharacter long or an even number (greater than one) characters long.
POD document had syntax errors
(F) The POD document being formatted had syntax errors and the "errors"option was set to "die".


If set and Encode is not available, silently fall back to non-UTF-8 modewithout complaining to standard error. This environment variable is setduring Perl core builds, which build Encode after podlators. Encode isexpected to not (yet) be available in that case.
If set, this will be used as the value of the left-hand footer unless the"date" option is explicitly set, overriding the timestamp of the inputfile or the current time. This is primarily useful to ensure reproduciblebuilds of the same output file given the same source and Pod::Man version,even when file timestamps may not be consistent.
If set, and POD_MAN_DATE and the "date" options are not set, this will beused as the modification time of the source file, overriding the timestamp ofthe input file or the current time. It should be set to the desired time inseconds since UNIX epoch. This is primarily useful to ensure reproduciblebuilds of the same output file given the same source and Pod::Man version,even when file timestamps may not be consistent. See<> for the fullspecification.

(Arguably, according to the specification, this variable should be used onlyif the timestamp of the input file is not available and Pod::Man uses thecurrent time. However, for reproducible builds in Debian, results were morereliable if this variable overrode the timestamp of the input file.)



Encoding handling assumes that PerlIO is available and does not workproperly if it isn't. The "utf8" option is therefore not supportedunless Perl is built with PerlIO support.

There is currently no way to turn off the guesswork that tries to formatunmarked text appropriately, and sometimes it isn't wanted (particularlywhen using POD to document something other than Perl). Most of the worktoward fixing this has now been done, however, and all that's still neededis a user interface.

The NAME section should be recognized specially and index entries emittedfor everything in that section. This would have to be deferred until thenext section, since extraneous things in NAME tends to confuse various manpage processors. Currently, no index entries are emitted for anything inNAME.

Pod::Man doesn't handle font names longer than two characters. Neither domost troff implementations, but GNU troff does as an extension. It wouldbe nice to support as an option for those who want to use it.

The preamble added to each output file is rather verbose, and most of itis only necessary in the presence of non-ASCII characters. It wouldideally be nice if all of those definitions were only output if needed,perhaps on the fly as the characters are used.

Pod::Man is excessively slow. 


If Pod::Man is given the "utf8" option, the encoding of its output filehandle will be forced to UTF-8 if possible, overriding any existingencoding. This will be done even if the file handle is not created byPod::Man and was passed in from outside. This maintains consistencyregardless of PERL_UNICODE and other settings.

The handling of hyphens and em dashes is somewhat fragile, and one may getthe wrong one under some circumstances. This should only matter fortroff output.

When and whether to use small caps is somewhat tricky, and Pod::Man doesn'tnecessarily get it right.

Converting neutral double quotes to properly matched double quotes doesn'twork unless there are no formatting codes between the quote marks. Thisonly matters for troff output. 


Russ Allbery <>, based very heavily on the originalpod2man by Tom Christiansen <>. The modifications towork with Pod::Simple instead of Pod::Parser were originally contributed bySean Burke (but I've since hacked them beyond recognition and all bugs aremine). 


Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,2009, 2010, 2012, 2013, 2014, 2015, 2016 Russ Allbery <>

This program is free software; you may redistribute it and/or modify itunder the same terms as Perl itself. 


Pod::Simple, perlpod(1), pod2man(1), nroff(1), troff(1),man(1), man(7)

Ossanna, Joseph F., and Brian W. Kernighan. ``Troff User's Manual,''Computing Science Technical Report No. 54, AT&T Bell Laboratories. This isthe best documentation of standard nroff and troff. At the time ofthis writing, it's available at<>.

The man page documenting the man macro set may be man(5) instead ofman(7) on your system. Also, please see pod2man(1) for extensivedocumentation on writing manual pages if you've not done it before andaren't familiar with the conventions.

The current version of this module is always available from its web site at<>. It is also part of thePerl core distribution as of 5.6.0.




This document was created byman2html,using the manual pages.