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 to use instead of "User Contributed
61           Perl Documentation".
62
63       errors
64           How to report errors.  "die" says to throw an exception on any POD
65           formatting error.  "stderr" says to report errors on standard
66           error, but not to throw an exception.  "pod" says to include a POD
67           ERRORS section in the resulting documentation summarizing the
68           errors.  "none" ignores POD errors entirely, as much as possible.
69
70           The default is "output".
71
72       date
73           Sets the left-hand footer.  By default, the modification date of
74           the input file will be used, or the current date if stat() can't
75           find that file (the case if the input is from "STDIN"), and the
76           date will be formatted as "YYYY-MM-DD".
77
78       fixed
79           The fixed-width font to use for verbatim text and code.  Defaults
80           to "CW".  Some systems may want "CR" instead.  Only matters for
81           troff output.
82
83       fixedbold
84           Bold version of the fixed-width font.  Defaults to "CB".  Only
85           matters for troff output.
86
87       fixeditalic
88           Italic version of the fixed-width font (actually, something of a
89           misnomer, since most fixed-width fonts only have an oblique
90           version, not an italic version).  Defaults to "CI".  Only matters
91           for troff output.
92
93       fixedbolditalic
94           Bold italic (probably actually oblique) version of the fixed-width
95           font.  Pod::Man doesn't assume you have this, and defaults to "CB".
96           Some systems (such as Solaris) have this font available as "CX".
97           Only matters for troff output.
98
99       name
100           Set the name of the manual page.  Without this option, the manual
101           name is set to the uppercased base name of the file being converted
102           unless the manual section is 3, in which case the path is parsed to
103           see if it is a Perl module path.  If it is, a path like
104           ".../lib/Pod/Man.pm" is converted into a name like "Pod::Man".
105           This option, if given, overrides any automatic determination of the
106           name.
107
108       nourls
109           Normally, L<> formatting codes with a URL but anchor text are
110           formatted to show both the anchor text and the URL.  In other
111           words:
112
113               L<foo|http://example.com/>
114
115           is formatted as:
116
117               foo <http://example.com/>
118
119           This option, if set to a true value, suppresses the URL when anchor
120           text is given, so this example would be formatted as just "foo".
121           This can produce less cluttered output in cases where the URLs are
122           not particularly important.
123
124       quotes
125           Sets the quote marks used to surround C<> text.  If the value is a
126           single character, it is used as both the left and right quote; if
127           it is two characters, the first character is used as the left quote
128           and the second as the right quoted; and if it is four characters,
129           the first two are used as the left quote and the second two as the
130           right quote.
131
132           This may also be set to the special value "none", in which case no
133           quote marks are added around C<> text (but the font is still
134           changed for troff output).
135
136       release
137           Set the centered footer.  By default, this is the version of Perl
138           you run Pod::Man under.  Note that some system an macro sets assume
139           that the centered footer will be a modification date and will
140           prepend something like "Last modified: "; if this is the case, you
141           may want to set "release" to the last modified date and "date" to
142           the version number.
143
144       section
145           Set the section for the ".TH" macro.  The standard section
146           numbering convention is to use 1 for user commands, 2 for system
147           calls, 3 for functions, 4 for devices, 5 for file formats, 6 for
148           games, 7 for miscellaneous information, and 8 for administrator
149           commands.  There is a lot of variation here, however; some systems
150           (like Solaris) use 4 for file formats, 5 for miscellaneous
151           information, and 7 for devices.  Still others use 1m instead of 8,
152           or some mix of both.  About the only section numbers that are
153           reliably consistent are 1, 2, and 3.
154
155           By default, section 1 will be used unless the file ends in ".pm" in
156           which case section 3 will be selected.
157
158       stderr
159           Send error messages about invalid POD to standard error instead of
160           appending a POD ERRORS section to the generated *roff output.  This
161           is equivalent to setting "errors" to "stderr" if "errors" is not
162           already set.  It is supported for backward compatibility.
163
164       utf8
165           By default, Pod::Man produces the most conservative possible *roff
166           output to try to ensure that it will work with as many different
167           *roff implementations as possible.  Many *roff implementations
168           cannot handle non-ASCII characters, so this means all non-ASCII
169           characters are converted either to a *roff escape sequence that
170           tries to create a properly accented character (at least for troff
171           output) or to "X".
172
173           If this option is set, Pod::Man will instead output UTF-8.  If your
174           *roff implementation can handle it, this is the best output format
175           to use and avoids corruption of documents containing non-ASCII
176           characters.  However, be warned that *roff source with literal
177           UTF-8 characters is not supported by many implementations and may
178           even result in segfaults and other bad behavior.
179
180           Be aware that, when using this option, the input encoding of your
181           POD source must be properly declared unless it is US-ASCII or
182           Latin-1.  POD input without an "=encoding" command will be assumed
183           to be in Latin-1, and if it's actually in UTF-8, the output will be
184           double-encoded.  See perlpod(1) for more information on the
185           "=encoding" command.
186
187       The standard Pod::Simple method parse_file() takes one argument naming
188       the POD file to read from.  By default, the output is sent to "STDOUT",
189       but this can be changed with the output_fd() method.
190
191       The standard Pod::Simple method parse_from_file() takes up to two
192       arguments, the first being the input file to read POD from and the
193       second being the file to write the formatted output to.
194
195       You can also call parse_lines() to parse an array of lines or
196       parse_string_document() to parse a document already in memory.  To put
197       the output into a string instead of a file handle, call the
198       output_string() method.  See Pod::Simple for the specific details.
199

DIAGNOSTICS

201       roff font should be 1 or 2 chars, not "%s"
202           (F) You specified a *roff font (using "fixed", "fixedbold", etc.)
203           that wasn't either one or two characters.  Pod::Man doesn't support
204           *roff fonts longer than two characters, although some *roff
205           extensions do (the canonical versions of nroff and troff don't
206           either).
207
208       Invalid errors setting "%s"
209           (F) The "errors" parameter to the constructor was set to an unknown
210           value.
211
212       Invalid quote specification "%s"
213           (F) The quote specification given (the "quotes" option to the
214           constructor) was invalid.  A quote specification must be one, two,
215           or four characters long.
216
217       POD document had syntax errors
218           (F) The POD document being formatted had syntax errors and the
219           "errors" option was set to "die".
220

BUGS

222       Encoding handling assumes that PerlIO is available and does not work
223       properly if it isn't.  The "utf8" option is therefore not supported
224       unless Perl is built with PerlIO support.
225
226       There is currently no way to turn off the guesswork that tries to
227       format unmarked text appropriately, and sometimes it isn't wanted
228       (particularly when using POD to document something other than Perl).
229       Most of the work toward fixing this has now been done, however, and all
230       that's still needed is a user interface.
231
232       The NAME section should be recognized specially and index entries
233       emitted for everything in that section.  This would have to be deferred
234       until the next section, since extraneous things in NAME tends to
235       confuse various man page processors.  Currently, no index entries are
236       emitted for anything in NAME.
237
238       Pod::Man doesn't handle font names longer than two characters.  Neither
239       do most troff implementations, but GNU troff does as an extension.  It
240       would be nice to support as an option for those who want to use it.
241
242       The preamble added to each output file is rather verbose, and most of
243       it is only necessary in the presence of non-ASCII characters.  It would
244       ideally be nice if all of those definitions were only output if needed,
245       perhaps on the fly as the characters are used.
246
247       Pod::Man is excessively slow.
248

CAVEATS

250       If Pod::Man is given the "utf8" option, the encoding of its output file
251       handle will be forced to UTF-8 if possible, overriding any existing
252       encoding.  This will be done even if the file handle is not created by
253       Pod::Man and was passed in from outside.  This maintains consistency
254       regardless of PERL_UNICODE and other settings.
255
256       The handling of hyphens and em dashes is somewhat fragile, and one may
257       get the wrong one under some circumstances.  This should only matter
258       for troff output.
259
260       When and whether to use small caps is somewhat tricky, and Pod::Man
261       doesn't necessarily get it right.
262
263       Converting neutral double quotes to properly matched double quotes
264       doesn't work unless there are no formatting codes between the quote
265       marks.  This only matters for troff output.
266

AUTHOR

268       Russ Allbery <rra@stanford.edu>, based very heavily on the original
269       pod2man by Tom Christiansen <tchrist@mox.perl.com>.  The modifications
270       to work with Pod::Simple instead of Pod::Parser were originally
271       contributed by Sean Burke (but I've since hacked them beyond
272       recognition and all bugs are mine).
273
275       Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
276       2009, 2010, 2012, 2013 Russ Allbery <rra@stanford.edu>.
277
278       This program is free software; you may redistribute it and/or modify it
279       under the same terms as Perl itself.
280

SEE ALSO

282       Pod::Simple, perlpod(1), pod2man(1), nroff(1), troff(1), man(1), man(7)
283
284       Ossanna, Joseph F., and Brian W. Kernighan.  "Troff User's Manual,"
285       Computing Science Technical Report No. 54, AT&T Bell Laboratories.
286       This is the best documentation of standard nroff and troff.  At the
287       time of this writing, it's available at
288       <http://www.cs.bell-labs.com/cm/cs/cstr.html>.
289
290       The man page documenting the man macro set may be man(5) instead of
291       man(7) on your system.  Also, please see pod2man(1) for extensive
292       documentation on writing manual pages if you've not done it before and
293       aren't familiar with the conventions.
294
295       The current version of this module is always available from its web
296       site at <http://www.eyrie.org/~eagle/software/podlators/>.  It is also
297       part of the Perl core distribution as of 5.6.0.
298
299
300
301perl v5.16.3                      2013-01-02                       Pod::Man(3)
Impressum