1Pod::Man(3pm) Perl Programmers Reference Guide Pod::Man(3pm)
2
3
4
6 Pod::Man - Convert POD data to formatted *roff input
7
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_from_filehandle;
14
15 # Read POD from file.pod and write to file.1.
16 $parser->parse_from_file ('file.pod', 'file.1');
17
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 ter‐
22 minal using nroff(1), normally via man(1), or printing using troff(1).
23 It is conventionally invoked using the driver script pod2man, but it
24 can also be used directly.
25
26 As a derived class from Pod::Parser, Pod::Man supports the same methods
27 and interfaces. See Pod::Parser for all the details; briefly, one cre‐
28 ates a new parser with "Pod::Man->new()" and then calls either
29 parse_from_filehandle() or parse_from_file().
30
31 new() can take options, in the form of key/value pairs that control the
32 behavior of the parser. See below for details.
33
34 If no options are given, Pod::Man uses the name of the input file with
35 any trailing ".pod", ".pm", or ".pl" stripped as the man page title, to
36 section 1 unless the file ended in ".pm" in which case it defaults to
37 section 3, to a centered title of "User Contributed Perl Documenta‐
38 tion", to a centered footer of the Perl version it is run with, and to
39 a left-hand footer of the modification date of its input (or the cur‐
40 rent date if given STDIN for input).
41
42 Pod::Man assumes that your *roff formatters have a fixed-width font
43 named CW. If yours is called something else (like CR), use the "fixed"
44 option to specify it. This generally only matters for troff output for
45 printing. Similarly, you can set the fonts used for bold, italic, and
46 bold italic fixed-width output.
47
48 Besides the obvious pod conversions, Pod::Man also takes care of for‐
49 matting func(), func(3), and simple variable references like $foo or
50 @bar so you don't have to use code escapes for them; complex expres‐
51 sions like $fred{'stuff'} will still need to be escaped, though. It
52 also translates dashes that aren't used as hyphens into en dashes,
53 makes long dashes--like this--into proper em dashes, fixes "paired
54 quotes," makes C++ look right, puts a little space between double
55 underbars, makes ALLCAPS a teeny bit smaller in troff, and escapes
56 stuff that *roff treats as special so that you don't have to.
57
58 The recognized options to new() are as follows. All options take a
59 single argument.
60
61 center
62 Sets the centered page header to use instead of "User Contributed
63 Perl Documentation".
64
65 date
66 Sets the left-hand footer. By default, the modification date of
67 the input file will be used, or the current date if stat() can't
68 find that file (the case if the input is from STDIN), and the date
69 will be formatted as YYYY-MM-DD.
70
71 fixed
72 The fixed-width font to use for vertabim text and code. Defaults
73 to CW. Some systems may want CR instead. Only matters for troff
74 output.
75
76 fixedbold
77 Bold version of the fixed-width font. Defaults to CB. Only mat‐
78 ters for troff output.
79
80 fixeditalic
81 Italic version of the fixed-width font (actually, something of a
82 misnomer, since most fixed-width fonts only have an oblique ver‐
83 sion, not an italic version). Defaults to CI. Only matters for
84 troff output.
85
86 fixedbolditalic
87 Bold italic (probably actually oblique) version of the fixed-width
88 font. Pod::Man doesn't assume you have this, and defaults to CB.
89 Some systems (such as Solaris) have this font available as CX.
90 Only matters for troff output.
91
92 name
93 Set the name of the manual page. Without this option, the manual
94 name is set to the uppercased base name of the file being converted
95 unless the manual section is 3, in which case the path is parsed to
96 see if it is a Perl module path. If it is, a path like
97 ".../lib/Pod/Man.pm" is converted into a name like "Pod::Man".
98 This option, if given, overrides any automatic determination of the
99 name.
100
101 quotes
102 Sets the quote marks used to surround C<> text. If the value is a
103 single character, it is used as both the left and right quote; if
104 it is two characters, the first character is used as the left quote
105 and the second as the right quoted; and if it is four characters,
106 the first two are used as the left quote and the second two as the
107 right quote.
108
109 This may also be set to the special value "none", in which case no
110 quote marks are added around C<> text (but the font is still
111 changed for troff output).
112
113 release
114 Set the centered footer. By default, this is the version of Perl
115 you run Pod::Man under. Note that some system an macro sets assume
116 that the centered footer will be a modification date and will
117 prepend something like "Last modified: "; if this is the case, you
118 may want to set "release" to the last modified date and "date" to
119 the version number.
120
121 section
122 Set the section for the ".TH" macro. The standard section number‐
123 ing convention is to use 1 for user commands, 2 for system calls, 3
124 for functions, 4 for devices, 5 for file formats, 6 for games, 7
125 for miscellaneous information, and 8 for administrator commands.
126 There is a lot of variation here, however; some systems (like
127 Solaris) use 4 for file formats, 5 for miscellaneous information,
128 and 7 for devices. Still others use 1m instead of 8, or some mix
129 of both. About the only section numbers that are reliably consis‐
130 tent are 1, 2, and 3.
131
132 By default, section 1 will be used unless the file ends in .pm in
133 which case section 3 will be selected.
134
135 The standard Pod::Parser method parse_from_filehandle() takes up to two
136 arguments, the first being the file handle to read POD from and the
137 second being the file handle to write the formatted output to. The
138 first defaults to STDIN if not given, and the second defaults to STD‐
139 OUT. The method parse_from_file() is almost identical, except that its
140 two arguments are the input and output disk files instead. See
141 Pod::Parser for the specific details.
142
144 roff font should be 1 or 2 chars, not "%s"
145 (F) You specified a *roff font (using "fixed", "fixedbold", etc.)
146 that wasn't either one or two characters. Pod::Man doesn't support
147 *roff fonts longer than two characters, although some *roff exten‐
148 sions do (the canonical versions of nroff and troff don't either).
149
150 Invalid link %s
151 (W) The POD source contained a "L<>" formatting code that Pod::Man
152 was unable to parse. You should never see this error message; it
153 probably indicates a bug in Pod::Man.
154
155 Invalid quote specification "%s"
156 (F) The quote specification given (the quotes option to the con‐
157 structor) was invalid. A quote specification must be one, two, or
158 four characters long.
159
160 %s:%d: Unknown command paragraph "%s".
161 (W) The POD source contained a non-standard command paragraph
162 (something of the form "=command args") that Pod::Man didn't know
163 about. It was ignored.
164
165 %s:%d: Unknown escape E<%s>
166 (W) The POD source contained an "E<>" escape that Pod::Man didn't
167 know about. "E<%s>" was printed verbatim in the output.
168
169 %s:%d: Unknown formatting code %s
170 (W) The POD source contained a non-standard formatting code (some‐
171 thing of the form "X<>") that Pod::Man didn't know about. It was
172 ignored.
173
174 %s:%d: Unmatched =back
175 (W) Pod::Man encountered a "=back" command that didn't correspond
176 to an "=over" command.
177
179 Eight-bit input data isn't handled at all well at present. The correct
180 approach would be to map E<> escapes to the appropriate UTF-8 charac‐
181 ters and then do a translation pass on the output according to the
182 user-specified output character set. Unfortunately, we can't send
183 eight-bit data directly to the output unless the user says this is
184 okay, since some vendor *roff implementations can't handle eight-bit
185 data. If the *roff implementation can, however, that's far superior to
186 the current hacked characters that only work under troff.
187
188 There is currently no way to turn off the guesswork that tries to for‐
189 mat unmarked text appropriately, and sometimes it isn't wanted (partic‐
190 ularly when using POD to document something other than Perl).
191
192 The NAME section should be recognized specially and index entries emit‐
193 ted for everything in that section. This would have to be deferred
194 until the next section, since extraneous things in NAME tends to con‐
195 fuse various man page processors.
196
197 Pod::Man doesn't handle font names longer than two characters. Neither
198 do most troff implementations, but GNU troff does as an extension. It
199 would be nice to support as an option for those who want to use it.
200
201 The preamble added to each output file is rather verbose, and most of
202 it is only necessary in the presence of E<> escapes for non-ASCII char‐
203 acters. It would ideally be nice if all of those definitions were only
204 output if needed, perhaps on the fly as the characters are used.
205
206 Pod::Man is excessively slow.
207
209 The handling of hyphens and em dashes is somewhat fragile, and one may
210 get the wrong one under some circumstances. This should only matter
211 for troff output.
212
213 When and whether to use small caps is somewhat tricky, and Pod::Man
214 doesn't necessarily get it right.
215
217 Pod::Parser, perlpod(1), pod2man(1), nroff(1), troff(1), man(1), man(7)
218
219 Ossanna, Joseph F., and Brian W. Kernighan. "Troff User's Manual,"
220 Computing Science Technical Report No. 54, AT&T Bell Laboratories.
221 This is the best documentation of standard nroff and troff. At the
222 time of this writing, it's available at
223 <http://www.cs.bell-labs.com/cm/cs/cstr.html>.
224
225 The man page documenting the man macro set may be man(5) instead of
226 man(7) on your system. Also, please see pod2man(1) for extensive docu‐
227 mentation on writing manual pages if you've not done it before and
228 aren't familiar with the conventions.
229
230 The current version of this module is always available from its web
231 site at <http://www.eyrie.org/~eagle/software/podlators/>. It is also
232 part of the Perl core distribution as of 5.6.0.
233
235 Russ Allbery <rra@stanford.edu>, based very heavily on the original
236 pod2man by Tom Christiansen <tchrist@mox.perl.com>.
237
239 Copyright 1999, 2000, 2001, 2002, 2003 by Russ Allbery <rra@stan‐
240 ford.edu>.
241
242 This program is free software; you may redistribute it and/or modify it
243 under the same terms as Perl itself.
244
245
246
247perl v5.8.8 2001-09-21 Pod::Man(3pm)