1Pod::Man(3)           User Contributed Perl Documentation          Pod::Man(3)
2
3
4

NAME

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

SYNOPSIS

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

DESCRIPTION

19       Pod::Man is a module to convert documentation in the POD format (the
20       preferred language for documenting Perl) into *roff input using the man
21       macro set.  The resulting *roff code is suitable for display on a
22       terminal using nroff(1), normally via man(1), or printing using
23       troff(1).  It is conventionally invoked using the driver script
24       pod2man, but it can also be used directly.
25
26       As a derived class from Pod::Simple, Pod::Man supports the same methods
27       and interfaces.  See Pod::Simple for all the details.
28
29       new() can take options, in the form of key/value pairs that control the
30       behavior of the parser.  See below for details.
31
32       If no options are given, Pod::Man uses the name of the input file with
33       any trailing ".pod", ".pm", or ".pl" stripped as the man page title, to
34       section 1 unless the file ended in ".pm" in which case it defaults to
35       section 3, to a centered title of "User Contributed Perl
36       Documentation", to a centered footer of the Perl version it is run
37       with, and to a left-hand footer of the modification date of its input
38       (or the current date if given "STDIN" for input).
39
40       Pod::Man assumes that your *roff formatters have a fixed-width font
41       named "CW".  If yours is called something else (like "CR"), use the
42       "fixed" option to specify it.  This generally only matters for troff
43       output for printing.  Similarly, you can set the fonts used for bold,
44       italic, and bold italic fixed-width output.
45
46       Besides the obvious pod conversions, Pod::Man also takes care of
47       formatting func(), func(3), and simple variable references like $foo or
48       @bar so you don't have to use code escapes for them; complex
49       expressions like $fred{'stuff'} will still need to be escaped, though.
50       It also translates dashes that aren't used as hyphens into en dashes,
51       makes long dashes--like this--into proper em dashes, fixes "paired
52       quotes," makes C++ look right, puts a little space between double
53       underscores, makes ALLCAPS a teeny bit smaller in troff, and escapes
54       stuff that *roff treats as special so that you don't have to.
55
56       The recognized options to new() are as follows.  All options take a
57       single argument.
58
59       center
60           Sets the centered page header for the ".TH" macro.  The default, if
61           this option is not specified, is "User Contributed Perl
62           Documentation".
63
64       date
65           Sets the left-hand footer for the ".TH" macro.  If this option is
66           not set, the contents of the environment variable POD_MAN_DATE, if
67           set, will be used.  Failing that, the value of SOURCE_DATE_EPOCH,
68           the modification date of the input file, or the current time if
69           stat() can't find that file (which will be the case if the input is
70           from "STDIN") will be used.  If obtained from the file modification
71           date or the current time, the date will be formatted as
72           "YYYY-MM-DD" and will be based on UTC (so that the output will be
73           reproducible regardless of local time zone).
74
75       errors
76           How to report errors.  "die" says to throw an exception on any POD
77           formatting error.  "stderr" says to report errors on standard
78           error, but not to throw an exception.  "pod" says to include a POD
79           ERRORS section in the resulting documentation summarizing the
80           errors.  "none" ignores POD errors entirely, as much as possible.
81
82           The default is "pod".
83
84       fixed
85           The fixed-width font to use for verbatim text and code.  Defaults
86           to "CW".  Some systems may want "CR" instead.  Only matters for
87           troff output.
88
89       fixedbold
90           Bold version of the fixed-width font.  Defaults to "CB".  Only
91           matters for troff output.
92
93       fixeditalic
94           Italic version of the fixed-width font (actually, something of a
95           misnomer, since most fixed-width fonts only have an oblique
96           version, not an italic version).  Defaults to "CI".  Only matters
97           for troff output.
98
99       fixedbolditalic
100           Bold italic (probably actually oblique) version of the fixed-width
101           font.  Pod::Man doesn't assume you have this, and defaults to "CB".
102           Some systems (such as Solaris) have this font available as "CX".
103           Only matters for troff output.
104
105       lquote
106       rquote
107           Sets the quote marks used to surround C<> text.  "lquote" sets the
108           left quote mark and "rquote" sets the right quote mark.  Either may
109           also be set to the special value "none", in which case no quote
110           mark is added on that side of C<> text (but the font is still
111           changed for troff output).
112
113           Also see the "quotes" option, which can be used to set both quotes
114           at once.  If both "quotes" and one of the other options is set,
115           "lquote" or "rquote" overrides "quotes".
116
117       name
118           Set the name of the manual page for the ".TH" macro.  Without this
119           option, the manual name is set to the uppercased base name of the
120           file being converted unless the manual section is 3, in which case
121           the path is parsed to see if it is a Perl module path.  If it is, a
122           path like ".../lib/Pod/Man.pm" is converted into a name like
123           "Pod::Man".  This option, if given, overrides any automatic
124           determination of the name.
125
126           If generating a manual page from standard input, the name will be
127           set to "STDIN" if this option is not provided.  Providing this
128           option is strongly recommended to set a meaningful manual page
129           name.
130
131       nourls
132           Normally, L<> formatting codes with a URL but anchor text are
133           formatted to show both the anchor text and the URL.  In other
134           words:
135
136               L<foo|http://example.com/>
137
138           is formatted as:
139
140               foo <http://example.com/>
141
142           This option, if set to a true value, suppresses the URL when anchor
143           text is given, so this example would be formatted as just "foo".
144           This can produce less cluttered output in cases where the URLs are
145           not particularly important.
146
147       quotes
148           Sets the quote marks used to surround C<> text.  If the value is a
149           single character, it is used as both the left and right quote.
150           Otherwise, it is split in half, and the first half of the string is
151           used as the left quote and the second is used as the right quote.
152
153           This may also be set to the special value "none", in which case no
154           quote marks are added around C<> text (but the font is still
155           changed for troff output).
156
157           Also see the "lquote" and "rquote" options, which can be used to
158           set the left and right quotes independently.  If both "quotes" and
159           one of the other options is set, "lquote" or "rquote" overrides
160           "quotes".
161
162       release
163           Set the centered footer for the ".TH" macro.  By default, this is
164           set to the version of Perl you run Pod::Man under.  Setting this to
165           the empty string will cause some *roff implementations to use the
166           system default value.
167
168           Note that some system "an" macro sets assume that the centered
169           footer will be a modification date and will prepend something like
170           "Last modified: ".  If this is the case for your target system, you
171           may want to set "release" to the last modified date and "date" to
172           the version number.
173
174       section
175           Set the section for the ".TH" macro.  The standard section
176           numbering convention is to use 1 for user commands, 2 for system
177           calls, 3 for functions, 4 for devices, 5 for file formats, 6 for
178           games, 7 for miscellaneous information, and 8 for administrator
179           commands.  There is a lot of variation here, however; some systems
180           (like Solaris) use 4 for file formats, 5 for miscellaneous
181           information, and 7 for devices.  Still others use 1m instead of 8,
182           or some mix of both.  About the only section numbers that are
183           reliably consistent are 1, 2, and 3.
184
185           By default, section 1 will be used unless the file ends in ".pm" in
186           which case section 3 will be selected.
187
188       stderr
189           Send error messages about invalid POD to standard error instead of
190           appending a POD ERRORS section to the generated *roff output.  This
191           is equivalent to setting "errors" to "stderr" if "errors" is not
192           already set.  It is supported for backward compatibility.
193
194       utf8
195           By default, Pod::Man produces the most conservative possible *roff
196           output to try to ensure that it will work with as many different
197           *roff implementations as possible.  Many *roff implementations
198           cannot handle non-ASCII characters, so this means all non-ASCII
199           characters are converted either to a *roff escape sequence that
200           tries to create a properly accented character (at least for troff
201           output) or to "X".
202
203           If this option is set, Pod::Man will instead output UTF-8.  If your
204           *roff implementation can handle it, this is the best output format
205           to use and avoids corruption of documents containing non-ASCII
206           characters.  However, be warned that *roff source with literal
207           UTF-8 characters is not supported by many implementations and may
208           even result in segfaults and other bad behavior.
209
210           Be aware that, when using this option, the input encoding of your
211           POD source should be properly declared unless it's US-ASCII.
212           Pod::Simple will attempt to guess the encoding and may be
213           successful if it's Latin-1 or UTF-8, but it will produce warnings.
214           Use the "=encoding" command to declare the encoding.  See
215           perlpod(1) for more information.
216
217       The standard Pod::Simple method parse_file() takes one argument naming
218       the POD file to read from.  By default, the output is sent to "STDOUT",
219       but this can be changed with the output_fh() method.
220
221       The standard Pod::Simple method parse_from_file() takes up to two
222       arguments, the first being the input file to read POD from and the
223       second being the file to write the formatted output to.
224
225       You can also call parse_lines() to parse an array of lines or
226       parse_string_document() to parse a document already in memory.  As with
227       parse_file(), parse_lines() and parse_string_document() default to
228       sending their output to "STDOUT" unless changed with the output_fh()
229       method.  Be aware that parse_lines() and parse_string_document() both
230       expect raw bytes, not decoded characters.
231
232       To put the output from any parse method into a string instead of a file
233       handle, call the output_string() method instead of output_fh().
234
235       See Pod::Simple for more specific details on the methods available to
236       all derived parsers.
237

DIAGNOSTICS

239       roff font should be 1 or 2 chars, not "%s"
240           (F) You specified a *roff font (using "fixed", "fixedbold", etc.)
241           that wasn't either one or two characters.  Pod::Man doesn't support
242           *roff fonts longer than two characters, although some *roff
243           extensions do (the canonical versions of nroff and troff don't
244           either).
245
246       Invalid errors setting "%s"
247           (F) The "errors" parameter to the constructor was set to an unknown
248           value.
249
250       Invalid quote specification "%s"
251           (F) The quote specification given (the "quotes" option to the
252           constructor) was invalid.  A quote specification must be either one
253           character long or an even number (greater than one) characters
254           long.
255
256       POD document had syntax errors
257           (F) The POD document being formatted had syntax errors and the
258           "errors" option was set to "die".
259

ENVIRONMENT

261       PERL_CORE
262           If set and Encode is not available, silently fall back to non-UTF-8
263           mode without complaining to standard error.  This environment
264           variable is set during Perl core builds, which build Encode after
265           podlators.  Encode is expected to not (yet) be available in that
266           case.
267
268       POD_MAN_DATE
269           If set, this will be used as the value of the left-hand footer
270           unless the "date" option is explicitly set, overriding the
271           timestamp of the input file or the current time.  This is primarily
272           useful to ensure reproducible builds of the same output file given
273           the same source and Pod::Man version, even when file timestamps may
274           not be consistent.
275
276       SOURCE_DATE_EPOCH
277           If set, and POD_MAN_DATE and the "date" options are not set, this
278           will be used as the modification time of the source file,
279           overriding the timestamp of the input file or the current time.  It
280           should be set to the desired time in seconds since UNIX epoch.
281           This is primarily useful to ensure reproducible builds of the same
282           output file given the same source and Pod::Man version, even when
283           file timestamps may not be consistent.  See
284           <https://reproducible-builds.org/specs/source-date-epoch/> for the
285           full specification.
286
287           (Arguably, according to the specification, this variable should be
288           used only if the timestamp of the input file is not available and
289           Pod::Man uses the current time.  However, for reproducible builds
290           in Debian, results were more reliable if this variable overrode the
291           timestamp of the input file.)
292

BUGS

294       Encoding handling assumes that PerlIO is available and does not work
295       properly if it isn't.  The "utf8" option is therefore not supported
296       unless Perl is built with PerlIO support.
297
298       There is currently no way to turn off the guesswork that tries to
299       format unmarked text appropriately, and sometimes it isn't wanted
300       (particularly when using POD to document something other than Perl).
301       Most of the work toward fixing this has now been done, however, and all
302       that's still needed is a user interface.
303
304       The NAME section should be recognized specially and index entries
305       emitted for everything in that section.  This would have to be deferred
306       until the next section, since extraneous things in NAME tends to
307       confuse various man page processors.  Currently, no index entries are
308       emitted for anything in NAME.
309
310       Pod::Man doesn't handle font names longer than two characters.  Neither
311       do most troff implementations, but GNU troff does as an extension.  It
312       would be nice to support as an option for those who want to use it.
313
314       The preamble added to each output file is rather verbose, and most of
315       it is only necessary in the presence of non-ASCII characters.  It would
316       ideally be nice if all of those definitions were only output if needed,
317       perhaps on the fly as the characters are used.
318
319       Pod::Man is excessively slow.
320

CAVEATS

322       If Pod::Man is given the "utf8" option, the encoding of its output file
323       handle will be forced to UTF-8 if possible, overriding any existing
324       encoding.  This will be done even if the file handle is not created by
325       Pod::Man and was passed in from outside.  This maintains consistency
326       regardless of PERL_UNICODE and other settings.
327
328       The handling of hyphens and em dashes is somewhat fragile, and one may
329       get the wrong one under some circumstances.  This should only matter
330       for troff output.
331
332       When and whether to use small caps is somewhat tricky, and Pod::Man
333       doesn't necessarily get it right.
334
335       Converting neutral double quotes to properly matched double quotes
336       doesn't work unless there are no formatting codes between the quote
337       marks.  This only matters for troff output.
338

AUTHOR

340       Russ Allbery <rra@cpan.org>, based very heavily on the original pod2man
341       by Tom Christiansen <tchrist@mox.perl.com>.  The modifications to work
342       with Pod::Simple instead of Pod::Parser were originally contributed by
343       Sean Burke <sburke@cpan.org> (but I've since hacked them beyond
344       recognition and all bugs are mine).
345
347       Copyright 1999-2010, 2012-2019 Russ Allbery <rra@cpan.org>
348
349       Substantial contributions by Sean Burke <sburke@cpan.org>.
350
351       This program is free software; you may redistribute it and/or modify it
352       under the same terms as Perl itself.
353

SEE ALSO

355       Pod::Simple, perlpod(1), pod2man(1), nroff(1), troff(1), man(1), man(7)
356
357       Ossanna, Joseph F., and Brian W. Kernighan.  "Troff User's Manual,"
358       Computing Science Technical Report No. 54, AT&T Bell Laboratories.
359       This is the best documentation of standard nroff and troff.  At the
360       time of this writing, it's available at <http://www.troff.org/54.pdf>.
361
362       The man page documenting the man macro set may be man(5) instead of
363       man(7) on your system.  Also, please see pod2man(1) for extensive
364       documentation on writing manual pages if you've not done it before and
365       aren't familiar with the conventions.
366
367       The current version of this module is always available from its web
368       site at <https://www.eyrie.org/~eagle/software/podlators/>.  It is also
369       part of the Perl core distribution as of 5.6.0.
370
371
372
373perl v5.34.0                      2021-07-23                       Pod::Man(3)
Impressum