.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
. if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{\
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "Pod::Man 3perl"
.TH Pod::Man 3perl "2023-11-25" "perl v5.36.0" "Perl Programmers Reference Guide"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
Pod::Man \- Convert POD data to formatted *roff input
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 2
\& use Pod::Man;
\& my $parser = Pod::Man\->new (release => $VERSION, section => 8);
\&
\& # Read POD from STDIN and write to STDOUT.
\& $parser\->parse_file (\e*STDIN);
\&
\& # Read POD from file.pod and write to file.1.
\& $parser\->parse_from_file (\*(Aqfile.pod\*(Aq, \*(Aqfile.1\*(Aq);
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
Pod::Man is a module to convert documentation in the \s-1POD\s0 format (the
preferred language for documenting Perl) into *roff input using the man
macro set. The resulting *roff code is suitable for display on a terminal
using \fBnroff\fR\|(1), normally via \fBman\fR\|(1), or printing using \fBtroff\fR\|(1).
It is conventionally invoked using the driver script \fBpod2man\fR, but it can
also be used directly.
.PP
As a derived class from Pod::Simple, Pod::Man supports the same methods and
interfaces. See Pod::Simple for all the details.
.PP
\&\fBnew()\fR can take options, in the form of key/value pairs that control the
behavior of the parser. See below for details.
.PP
If no options are given, Pod::Man uses the name of the input file with any
trailing \f(CW\*(C`.pod\*(C'\fR, \f(CW\*(C`.pm\*(C'\fR, or \f(CW\*(C`.pl\*(C'\fR stripped as the man page title, to
section 1 unless the file ended in \f(CW\*(C`.pm\*(C'\fR in which case it defaults to
section 3, to a centered title of \*(L"User Contributed Perl Documentation\*(R", to
a centered footer of the Perl version it is run with, and to a left-hand
footer of the modification date of its input (or the current date if given
\&\f(CW\*(C`STDIN\*(C'\fR for input).
.PP
Pod::Man assumes that your *roff formatters have a fixed-width font named
\&\f(CW\*(C`CW\*(C'\fR. If yours is called something else (like \f(CW\*(C`CR\*(C'\fR), use the \f(CW\*(C`fixed\*(C'\fR
option to specify it. This generally only matters for troff output for
printing. Similarly, you can set the fonts used for bold, italic, and
bold italic fixed-width output.
.PP
Besides the obvious pod conversions, Pod::Man also takes care of
formatting \fBfunc()\fR, \fBfunc\fR\|(3), and simple variable references like \f(CW$foo\fR or
\&\f(CW@bar\fR so you don't have to use code escapes for them; complex expressions
like \f(CW$fred{\*(Aqstuff\*(Aq}\fR will still need to be escaped, though. It also
translates dashes that aren't used as hyphens into en dashes, makes long
dashes\*(--like this\*(--into proper em dashes, fixes \*(L"paired quotes,\*(R" makes \*(C+
look right, puts a little space between double underscores, makes \s-1ALLCAPS\s0
a teeny bit smaller in \fBtroff\fR, and escapes stuff that *roff treats as
special so that you don't have to.
.PP
The recognized options to \fBnew()\fR are as follows. All options take a single
argument.
.IP "center" 4
.IX Item "center"
Sets the centered page header for the \f(CW\*(C`.TH\*(C'\fR macro. The default, if this
option is not specified, is \*(L"User Contributed Perl Documentation\*(R".
.IP "date" 4
.IX Item "date"
Sets the left-hand footer for the \f(CW\*(C`.TH\*(C'\fR macro. If this option is not set,
the contents of the environment variable \s-1POD_MAN_DATE,\s0 if set, will be used.
Failing that, the value of \s-1SOURCE_DATE_EPOCH,\s0 the modification date of the
input file, or the current time if \fBstat()\fR can't find that file (which will be
the case if the input is from \f(CW\*(C`STDIN\*(C'\fR) will be used. If obtained from the
file modification date or the current time, the date will be formatted as
\&\f(CW\*(C`YYYY\-MM\-DD\*(C'\fR and will be based on \s-1UTC\s0 (so that the output will be
reproducible regardless of local time zone).
.IP "errors" 4
.IX Item "errors"
How to report errors. \f(CW\*(C`die\*(C'\fR says to throw an exception on any \s-1POD\s0
formatting error. \f(CW\*(C`stderr\*(C'\fR says to report errors on standard error, but
not to throw an exception. \f(CW\*(C`pod\*(C'\fR says to include a \s-1POD ERRORS\s0 section
in the resulting documentation summarizing the errors. \f(CW\*(C`none\*(C'\fR ignores
\&\s-1POD\s0 errors entirely, as much as possible.
.Sp
The default is \f(CW\*(C`pod\*(C'\fR.
.IP "fixed" 4
.IX Item "fixed"
The fixed-width font to use for verbatim text and code. Defaults to
\&\f(CW\*(C`CW\*(C'\fR. Some systems may want \f(CW\*(C`CR\*(C'\fR instead. Only matters for \fBtroff\fR
output.
.IP "fixedbold" 4
.IX Item "fixedbold"
Bold version of the fixed-width font. Defaults to \f(CW\*(C`CB\*(C'\fR. Only matters
for \fBtroff\fR output.
.IP "fixeditalic" 4
.IX Item "fixeditalic"
Italic version of the fixed-width font (actually, something of a misnomer,
since most fixed-width fonts only have an oblique version, not an italic
version). Defaults to \f(CW\*(C`CI\*(C'\fR. Only matters for \fBtroff\fR output.
.IP "fixedbolditalic" 4
.IX Item "fixedbolditalic"
Bold italic (probably actually oblique) version of the fixed-width font.
Pod::Man doesn't assume you have this, and defaults to \f(CW\*(C`CB\*(C'\fR. Some
systems (such as Solaris) have this font available as \f(CW\*(C`CX\*(C'\fR. Only matters
for \fBtroff\fR output.
.IP "lquote" 4
.IX Item "lquote"
.PD 0
.IP "rquote" 4
.IX Item "rquote"
.PD
Sets the quote marks used to surround C<> text. \f(CW\*(C`lquote\*(C'\fR sets the
left quote mark and \f(CW\*(C`rquote\*(C'\fR sets the right quote mark. Either may also
be set to the special value \f(CW\*(C`none\*(C'\fR, in which case no quote mark is added
on that side of C<> text (but the font is still changed for troff
output).
.Sp
Also see the \f(CW\*(C`quotes\*(C'\fR option, which can be used to set both quotes at once.
If both \f(CW\*(C`quotes\*(C'\fR and one of the other options is set, \f(CW\*(C`lquote\*(C'\fR or \f(CW\*(C`rquote\*(C'\fR
overrides \f(CW\*(C`quotes\*(C'\fR.
.IP "name" 4
.IX Item "name"
Set the name of the manual page for the \f(CW\*(C`.TH\*(C'\fR macro. Without this
option, the manual name is set to the uppercased base name of the file
being converted unless the manual section is 3, in which case the path is
parsed to see if it is a Perl module path. If it is, a path like
\&\f(CW\*(C`.../lib/Pod/Man.pm\*(C'\fR is converted into a name like \f(CW\*(C`Pod::Man\*(C'\fR. This
option, if given, overrides any automatic determination of the name.
.Sp
If generating a manual page from standard input, the name will be set to
\&\f(CW\*(C`STDIN\*(C'\fR if this option is not provided. Providing this option is strongly
recommended to set a meaningful manual page name.
.IP "nourls" 4
.IX Item "nourls"
Normally, L<> formatting codes with a \s-1URL\s0 but anchor text are formatted
to show both the anchor text and the \s-1URL.\s0 In other words:
.Sp
.Vb 1
\& L
.Ve
.Sp
is formatted as:
.Sp
.Vb 1
\& foo
.Ve
.Sp
This option, if set to a true value, suppresses the \s-1URL\s0 when anchor text
is given, so this example would be formatted as just \f(CW\*(C`foo\*(C'\fR. This can
produce less cluttered output in cases where the URLs are not particularly
important.
.IP "quotes" 4
.IX Item "quotes"
Sets the quote marks used to surround C<> text. If the value is a
single 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 left
quote and the second is used as the right quote.
.Sp
This may also be set to the special value \f(CW\*(C`none\*(C'\fR, in which case no quote
marks are added around C<> text (but the font is still changed for troff
output).
.Sp
Also see the \f(CW\*(C`lquote\*(C'\fR and \f(CW\*(C`rquote\*(C'\fR options, which can be used to set the
left and right quotes independently. If both \f(CW\*(C`quotes\*(C'\fR and one of the other
options is set, \f(CW\*(C`lquote\*(C'\fR or \f(CW\*(C`rquote\*(C'\fR overrides \f(CW\*(C`quotes\*(C'\fR.
.IP "release" 4
.IX Item "release"
Set the centered footer for the \f(CW\*(C`.TH\*(C'\fR macro. By default, this is set to
the version of Perl you run Pod::Man under. Setting this to the empty
string will cause some *roff implementations to use the system default
value.
.Sp
Note that some system \f(CW\*(C`an\*(C'\fR macro sets assume that the centered footer
will be a modification date and will prepend something like \*(L"Last
modified: \*(R". If this is the case for your target system, you may want to
set \f(CW\*(C`release\*(C'\fR to the last modified date and \f(CW\*(C`date\*(C'\fR to the version
number.
.IP "section" 4
.IX Item "section"
Set the section for the \f(CW\*(C`.TH\*(C'\fR macro. The standard section numbering
convention is to use 1 for user commands, 2 for system calls, 3 for
functions, 4 for devices, 5 for file formats, 6 for games, 7 for
miscellaneous information, and 8 for administrator commands. There is a lot
of variation here, however; some systems (like Solaris) use 4 for file
formats, 5 for miscellaneous information, and 7 for devices. Still others
use 1m instead of 8, or some mix of both. About the only section numbers
that are reliably consistent are 1, 2, and 3.
.Sp
By default, section 1 will be used unless the file ends in \f(CW\*(C`.pm\*(C'\fR in which
case section 3 will be selected.
.IP "stderr" 4
.IX Item "stderr"
Send error messages about invalid \s-1POD\s0 to standard error instead of
appending a \s-1POD ERRORS\s0 section to the generated *roff output. This is
equivalent to setting \f(CW\*(C`errors\*(C'\fR to \f(CW\*(C`stderr\*(C'\fR if \f(CW\*(C`errors\*(C'\fR is not already
set. It is supported for backward compatibility.
.IP "utf8" 4
.IX Item "utf8"
By default, Pod::Man produces the most conservative possible *roff output
to try to ensure that it will work with as many different *roff
implementations as possible. Many *roff implementations cannot handle
non-ASCII characters, so this means all non-ASCII characters are converted
either to a *roff escape sequence that tries to create a properly accented
character (at least for troff output) or to \f(CW\*(C`X\*(C'\fR.
.Sp
If this option is set, Pod::Man will instead output \s-1UTF\-8.\s0 If your *roff
implementation can handle it, this is the best output format to use and
avoids corruption of documents containing non-ASCII characters. However,
be warned that *roff source with literal \s-1UTF\-8\s0 characters is not supported
by many implementations and may even result in segfaults and other bad
behavior.
.Sp
Be aware that, when using this option, the input encoding of your \s-1POD\s0
source should be properly declared unless it's US-ASCII. Pod::Simple will
attempt to guess the encoding and may be successful if it's Latin\-1 or
\&\s-1UTF\-8,\s0 but it will produce warnings. Use the \f(CW\*(C`=encoding\*(C'\fR command to
declare the encoding. See \fBperlpod\fR\|(1) for more information.
.PP
The standard Pod::Simple method \fBparse_file()\fR takes one argument naming the
\&\s-1POD\s0 file to read from. By default, the output is sent to \f(CW\*(C`STDOUT\*(C'\fR, but
this can be changed with the \fBoutput_fh()\fR method.
.PP
The standard Pod::Simple method \fBparse_from_file()\fR takes up to two
arguments, the first being the input file to read \s-1POD\s0 from and the second
being the file to write the formatted output to.
.PP
You can also call \fBparse_lines()\fR to parse an array of lines or
\&\fBparse_string_document()\fR to parse a document already in memory. As with
\&\fBparse_file()\fR, \fBparse_lines()\fR and \fBparse_string_document()\fR default to sending
their output to \f(CW\*(C`STDOUT\*(C'\fR unless changed with the \fBoutput_fh()\fR method. Be
aware that \fBparse_lines()\fR and \fBparse_string_document()\fR both expect raw bytes,
not decoded characters.
.PP
To put the output from any parse method into a string instead of a file
handle, call the \fBoutput_string()\fR method instead of \fBoutput_fh()\fR.
.PP
See Pod::Simple for more specific details on the methods available to
all derived parsers.
.SH "DIAGNOSTICS"
.IX Header "DIAGNOSTICS"
.ie n .IP "roff font should be 1 or 2 chars, not ""%s""" 4
.el .IP "roff font should be 1 or 2 chars, not ``%s''" 4
.IX Item "roff font should be 1 or 2 chars, not %s"
(F) You specified a *roff font (using \f(CW\*(C`fixed\*(C'\fR, \f(CW\*(C`fixedbold\*(C'\fR, etc.) that
wasn't either one or two characters. Pod::Man doesn't support *roff fonts
longer than two characters, although some *roff extensions do (the
canonical versions of \fBnroff\fR and \fBtroff\fR don't either).
.ie n .IP "Invalid errors setting ""%s""" 4
.el .IP "Invalid errors setting ``%s''" 4
.IX Item "Invalid errors setting %s"
(F) The \f(CW\*(C`errors\*(C'\fR parameter to the constructor was set to an unknown value.
.ie n .IP "Invalid quote specification ""%s""" 4
.el .IP "Invalid quote specification ``%s''" 4
.IX Item "Invalid quote specification %s"
(F) The quote specification given (the \f(CW\*(C`quotes\*(C'\fR option to the
constructor) was invalid. A quote specification must be either one
character long or an even number (greater than one) characters long.
.IP "\s-1POD\s0 document had syntax errors" 4
.IX Item "POD document had syntax errors"
(F) The \s-1POD\s0 document being formatted had syntax errors and the \f(CW\*(C`errors\*(C'\fR
option was set to \f(CW\*(C`die\*(C'\fR.
.SH "ENVIRONMENT"
.IX Header "ENVIRONMENT"
.IP "\s-1PERL_CORE\s0" 4
.IX Item "PERL_CORE"
If set and Encode is not available, silently fall back to non\-UTF\-8 mode
without complaining to standard error. This environment variable is set
during Perl core builds, which build Encode after podlators. Encode is
expected to not (yet) be available in that case.
.IP "\s-1POD_MAN_DATE\s0" 4
.IX Item "POD_MAN_DATE"
If set, this will be used as the value of the left-hand footer unless the
\&\f(CW\*(C`date\*(C'\fR option is explicitly set, overriding the timestamp of the input
file or the current time. This is primarily useful to ensure reproducible
builds of the same output file given the same source and Pod::Man version,
even when file timestamps may not be consistent.
.IP "\s-1SOURCE_DATE_EPOCH\s0" 4
.IX Item "SOURCE_DATE_EPOCH"
If set, and \s-1POD_MAN_DATE\s0 and the \f(CW\*(C`date\*(C'\fR options are not set, this will be
used as the modification time of the source file, overriding the timestamp of
the input file or the current time. It should be set to the desired time in
seconds since \s-1UNIX\s0 epoch. This is primarily useful to ensure reproducible
builds of the same output file given the same source and Pod::Man version,
even when file timestamps may not be consistent. See
for the full
specification.
.Sp
(Arguably, according to the specification, this variable should be used only
if the timestamp of the input file is not available and Pod::Man uses the
current time. However, for reproducible builds in Debian, results were more
reliable if this variable overrode the timestamp of the input file.)
.SH "BUGS"
.IX Header "BUGS"
Encoding handling assumes that PerlIO is available and does not work
properly if it isn't. The \f(CW\*(C`utf8\*(C'\fR option is therefore not supported
unless Perl is built with PerlIO support.
.PP
There is currently no way to turn off the guesswork that tries to format
unmarked text appropriately, and sometimes it isn't wanted (particularly
when using \s-1POD\s0 to document something other than Perl). Most of the work
toward fixing this has now been done, however, and all that's still needed
is a user interface.
.PP
The \s-1NAME\s0 section should be recognized specially and index entries emitted
for everything in that section. This would have to be deferred until the
next section, since extraneous things in \s-1NAME\s0 tends to confuse various man
page processors. Currently, no index entries are emitted for anything in
\&\s-1NAME.\s0
.PP
Pod::Man doesn't handle font names longer than two characters. Neither do
most \fBtroff\fR implementations, but \s-1GNU\s0 troff does as an extension. It would
be nice to support as an option for those who want to use it.
.PP
The preamble added to each output file is rather verbose, and most of it
is only necessary in the presence of non-ASCII characters. It would
ideally be nice if all of those definitions were only output if needed,
perhaps on the fly as the characters are used.
.PP
Pod::Man is excessively slow.
.SH "CAVEATS"
.IX Header "CAVEATS"
If Pod::Man is given the \f(CW\*(C`utf8\*(C'\fR option, the encoding of its output file
handle will be forced to \s-1UTF\-8\s0 if possible, overriding any existing
encoding. This will be done even if the file handle is not created by
Pod::Man and was passed in from outside. This maintains consistency
regardless of \s-1PERL_UNICODE\s0 and other settings.
.PP
The handling of hyphens and em dashes is somewhat fragile, and one may get
the wrong one under some circumstances. This should only matter for
\&\fBtroff\fR output.
.PP
When and whether to use small caps is somewhat tricky, and Pod::Man doesn't
necessarily get it right.
.PP
Converting neutral double quotes to properly matched double quotes doesn't
work unless there are no formatting codes between the quote marks. This
only matters for troff output.
.SH "AUTHOR"
.IX Header "AUTHOR"
Russ Allbery , based \fIvery\fR heavily on the original \fBpod2man\fR
by Tom Christiansen . The modifications to work with
Pod::Simple instead of Pod::Parser were originally contributed by Sean Burke
(but I've since hacked them beyond recognition and all bugs
are mine).
.SH "COPYRIGHT AND LICENSE"
.IX Header "COPYRIGHT AND LICENSE"
Copyright 1999\-2010, 2012\-2019 Russ Allbery
.PP
Substantial contributions by Sean Burke .
.PP
This program is free software; you may redistribute it and/or modify it
under the same terms as Perl itself.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
Pod::Simple, \fBperlpod\fR\|(1), \fBpod2man\fR\|(1), \fBnroff\fR\|(1), \fBtroff\fR\|(1),
\&\fBman\fR\|(1), \fBman\fR\|(7)
.PP
Ossanna, Joseph F., and Brian W. Kernighan. \*(L"Troff User's Manual,\*(R"
Computing Science Technical Report No. 54, \s-1AT&T\s0 Bell Laboratories. This is
the best documentation of standard \fBnroff\fR and \fBtroff\fR. At the time of
this writing, it's available at .
.PP
The man page documenting the man macro set may be \fBman\fR\|(5) instead of
\&\fBman\fR\|(7) on your system. Also, please see \fBpod2man\fR\|(1) for extensive
documentation on writing manual pages if you've not done it before and
aren't familiar with the conventions.
.PP
The current version of this module is always available from its web site at
. It is also part of the
Perl core distribution as of 5.6.0.