Debian Codegraph @

upstream/mageia-cauldron/man1/perlpodstyle.1

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\"
56 .\" Required to disable full justification in groff 1.23.0.
57 .if n .ds AD l
58 .\" ========================================================================
59 .\"
60 .IX Title "PERLPODSTYLE 1"
61 .TH PERLPODSTYLE 1 2025-06-24 "perl v5.42.0" "Perl Programmers Reference Guide"
62 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
63 .\" way too many mistakes in technical documents.
64 .if n .ad l
65 .nh
66 .SH NAME
67 perlpodstyle \- Perl POD style guide
68 .SH DESCRIPTION
69 .IX Header "DESCRIPTION"
70 These are general guidelines for how to write POD documentation for Perl
71 scripts and modules, based on general guidelines for writing good UNIX man
72 pages. All of these guidelines are, of course, optional, but following
73 them will make your documentation more consistent with other documentation
74 on the system.
75 .PP
76 The name of the program being documented is conventionally written in bold
77 (using B<>) wherever it occurs, as are all program options.
78 Arguments should be written in italics (I<>). Function names are
79 traditionally written in italics; if you write a function as \fBfunction()\fR,
80 Pod::Man will take care of this for you. Literal code or commands should
81 be in C<>. References to other man pages should be in the form
82 \&\f(CWmanpage(section)\fR or \f(CW\*(C`L<manpage(section)>\*(C'\fR, and Pod::Man will
83 automatically format those appropriately. The second form, with
84 L<>, is used to request that a POD formatter make a link to the
85 man page if possible. As an exception, one normally omits the section
86 when referring to module documentation since it\*(Aqs not clear what section
87 module documentation will be in; use \f(CW\*(C`L<Module::Name>\*(C'\fR for module
88 references instead.
89 .PP
90 References to other programs or functions are normally in the form of man
91 page references so that cross\-referencing tools can provide the user with
92 links and the like. It\*(Aqs possible to overdo this, though, so be careful not
93 to clutter your documentation with too much markup. References to other
94 programs that are not given as man page references should be enclosed in
95 B<>.
96 .PP
97 The major headers should be set out using a \f(CW\*(C`=head1\*(C'\fR directive, and are
98 historically written in the rather startling ALL UPPER CASE format; this
99 is not mandatory, but it\*(Aqs strongly recommended so that sections have
100 consistent naming across different software packages. Minor headers may
101 be included using \f(CW\*(C`=head2\*(C'\fR, and are typically in mixed case.
102 .PP
103 The standard sections of a manual page are:
104 .IP NAME 4
105 .IX Item "NAME"
106 Mandatory section; should be a comma\-separated list of programs or
107 functions documented by this POD page, such as:
108 .Sp
109 .Vb 1
110 \& foo, bar \- programs to do something
111 .Ve
112 .Sp
113 Manual page indexers are often extremely picky about the format of this
114 section, so don\*(Aqt put anything in it except this line. Every program or
115 function documented by this POD page should be listed, separated by a
116 comma and a space. For a Perl module, just give the module name. A
117 single dash, and only a single dash, should separate the list of programs
118 or functions from the description. Do not use any markup such as
119 C<> or B<> anywhere in this line. Functions should not be
120 qualified with \f(CW\*(C`()\*(C'\fR or the like. The description should ideally fit on a
121 single line, even if a man program replaces the dash with a few tabs.
122 .IP SYNOPSIS 4
123 .IX Item "SYNOPSIS"
124 A short usage summary for programs and functions. This section is
125 mandatory for section 3 pages. For Perl module documentation, it\*(Aqs
126 usually convenient to have the contents of this section be a verbatim
127 block showing some (brief) examples of typical ways the module is used.
128 .IP DESCRIPTION 4
129 .IX Item "DESCRIPTION"
130 Extended description and discussion of the program or functions, or the
131 body of the documentation for man pages that document something else. If
132 particularly long, it\*(Aqs a good idea to break this up into subsections
133 \&\f(CW\*(C`=head2\*(C'\fR directives like:
134 .Sp
135 .Vb 1
136 \& =head2 Normal Usage
137 \&
138 \& =head2 Advanced Features
139 \&
140 \& =head2 Writing Configuration Files
141 .Ve
142 .Sp
143 or whatever is appropriate for your documentation.
144 .Sp
145 For a module, this is generally where the documentation of the interfaces
146 provided by the module goes, usually in the form of a list with an
147 \&\f(CW\*(C`=item\*(C'\fR for each interface. Depending on how many interfaces there are,
148 you may want to put that documentation in separate METHODS, FUNCTIONS,
149 CLASS METHODS, or INSTANCE METHODS sections instead and save the
150 DESCRIPTION section for an overview.
151 .IP OPTIONS 4
152 .IX Item "OPTIONS"
153 Detailed description of each of the command\-line options taken by the
154 program. This should be separate from the description for the use of
155 parsers like Pod::Usage. This is normally presented as a list, with
156 each option as a separate \f(CW\*(C`=item\*(C'\fR. The specific option string should be
157 enclosed in B<>. Any values that the option takes should be
158 enclosed in I<>. For example, the section for the option
159 \&\fB\-\-section\fR=\fImanext\fR would be introduced with:
160 .Sp
161 .Vb 1
162 \& =item B<\-\-section>=I<manext>
163 .Ve
164 .Sp
165 Synonymous options (like both the short and long forms) are separated by a
166 comma and a space on the same \f(CW\*(C`=item\*(C'\fR line, or optionally listed as their
167 own item with a reference to the canonical name. For example, since
168 \&\fB\-\-section\fR can also be written as \fB\-s\fR, the above would be:
169 .Sp
170 .Vb 1
171 \& =item B<\-s> I<manext>, B<\-\-section>=I<manext>
172 .Ve
173 .Sp
174 Writing the short option first is recommended because it\*(Aqs easier to read.
175 The long option is long enough to draw the eye to it anyway and the short
176 option can otherwise get lost in visual noise.
177 .IP "RETURN VALUE" 4
178 .IX Item "RETURN VALUE"
179 What the program or function returns, if successful. This section can be
180 omitted for programs whose precise exit codes aren\*(Aqt important, provided
181 they return 0 on success and non\-zero on failure as is standard. It
182 should always be present for functions. For modules, it may be useful to
183 summarize return values from the module interface here, or it may be more
184 useful to discuss return values separately in the documentation of each
185 function or method the module provides.
186 .IP ERRORS 4
187 .IX Item "ERRORS"
188 Exceptions, error return codes, exit statuses, and errno settings.
189 Typically used for function or module documentation; program documentation
190 uses DIAGNOSTICS instead. The general rule of thumb is that errors
191 printed to \f(CW\*(C`STDOUT\*(C'\fR or \f(CW\*(C`STDERR\*(C'\fR and intended for the end user are
192 documented in DIAGNOSTICS while errors passed internal to the calling
193 program and intended for other programmers are documented in ERRORS. When
194 documenting a function that sets errno, a full list of the possible errno
195 values should be given here.
196 .IP DIAGNOSTICS 4
197 .IX Item "DIAGNOSTICS"
198 All possible messages the program can print out and what they mean. You
199 may wish to follow the same documentation style as the Perl documentation;
200 see \fBperldiag\fR\|(1) for more details (and look at the POD source as well).
201 .Sp
202 If applicable, please include details on what the user should do to
203 correct the error; documenting an error as indicating "the input buffer is
204 too small" without telling the user how to increase the size of the input
205 buffer (or at least telling them that it isn\*(Aqt possible) aren\*(Aqt very
206 useful.
207 .IP EXAMPLES 4
208 .IX Item "EXAMPLES"
209 Give some example uses of the program or function. Don\*(Aqt skimp; users
210 often find this the most useful part of the documentation. The examples
211 are generally given as verbatim paragraphs.
212 .Sp
213 Don\*(Aqt just present an example without explaining what it does. Adding a
214 short paragraph saying what the example will do can increase the value of
215 the example immensely.
216 .IP ENVIRONMENT 4
217 .IX Item "ENVIRONMENT"
218 Environment variables that the program cares about, normally presented as
219 a list using \f(CW\*(C`=over\*(C'\fR, \f(CW\*(C`=item\*(C'\fR, and \f(CW\*(C`=back\*(C'\fR. For example:
220 .Sp
221 .Vb 1
222 \& =over 6
223 \&
224 \& =item HOME
225 \&
226 \& Used to determine the user\*(Aqs home directory. F<.foorc> in this
227 \& directory is read for configuration details, if it exists.
228 \&
229 \& =back
230 .Ve
231 .Sp
232 Since environment variables are normally in all uppercase, no additional
233 special formatting is generally needed; they\*(Aqre glaring enough as it is.
234 .IP FILES 4
235 .IX Item "FILES"
236 All files used by the program or function, normally presented as a list,
237 and what it uses them for. File names should be enclosed in F<>.
238 It\*(Aqs particularly important to document files that will be potentially
239 modified.
240 .IP CAVEATS 4
241 .IX Item "CAVEATS"
242 Things to take special care with, sometimes called WARNINGS.
243 .IP BUGS 4
244 .IX Item "BUGS"
245 Things that are broken or just don\*(Aqt work quite right.
246 .IP RESTRICTIONS 4
247 .IX Item "RESTRICTIONS"
248 Bugs you don\*(Aqt plan to fix. :\-)
249 .IP NOTES 4
250 .IX Item "NOTES"
251 Miscellaneous commentary.
252 .IP AUTHOR 4
253 .IX Item "AUTHOR"
254 Who wrote it (use AUTHORS for multiple people). It\*(Aqs a good idea to
255 include your current e\-mail address (or some e\-mail address to which bug
256 reports should be sent) or some other contact information so that users
257 have a way of contacting you. Remember that program documentation tends
258 to roam the wild for far longer than you expect and pick a contact method
259 that\*(Aqs likely to last.
260 .IP HISTORY 4
261 .IX Item "HISTORY"
262 Programs derived from other sources sometimes have this. Some people keep
263 a modification log here, but that usually gets long and is normally better
264 maintained in a separate file.
265 .IP "COPYRIGHT AND LICENSE" 4
266 .IX Item "COPYRIGHT AND LICENSE"
267 For copyright
268 .Sp
269 .Vb 1
270 \& Copyright YEAR(s) YOUR NAME(s)
271 .Ve
272 .Sp
273 (No, (C) is not needed. No, "all rights reserved" is not needed.)
274 .Sp
275 For licensing the easiest way is to use the same licensing as Perl itself:
276 .Sp
277 .Vb 2
278 \& This library is free software; you may redistribute it and/or
279 \& modify it under the same terms as Perl itself.
280 .Ve
281 .Sp
282 This makes it easy for people to use your module with Perl. Note that
283 this licensing example is neither an endorsement nor a requirement, you are
284 of course free to choose any licensing.
285 .IP "SEE ALSO" 4
286 .IX Item "SEE ALSO"
287 Other man pages to check out, like \fBman\fR\|(1), \fBman\fR\|(7), \fBmakewhatis\fR\|(8), or
288 \&\fBcatman\fR\|(8). Normally a simple list of man pages separated by commas, or a
289 paragraph giving the name of a reference work. Man page references, if
290 they use the standard \f(CWname(section)\fR form, don\*(Aqt have to be enclosed in
291 L<> (although it\*(Aqs recommended), but other things in this section
292 probably should be when appropriate.
293 .Sp
294 If the package has a mailing list, include a URL or subscription
295 instructions here.
296 .Sp
297 If the package has a web site, include a URL here.
298 .PP
299 Documentation of object\-oriented libraries or modules may want to use
300 CONSTRUCTORS and METHODS sections, or CLASS METHODS and INSTANCE METHODS
301 sections, for detailed documentation of the parts of the library and save
302 the DESCRIPTION section for an overview. Large modules with a function
303 interface may want to use FUNCTIONS for similar reasons. Some people use
304 OVERVIEW to summarize the description if it\*(Aqs quite long.
305 .PP
306 Section ordering varies, although NAME must always be the first section
307 (you\*(Aqll break some man page systems otherwise), and NAME, SYNOPSIS,
308 DESCRIPTION, and OPTIONS generally always occur first and in that order if
309 present. In general, SEE ALSO, AUTHOR, and similar material should be
310 left for last. Some systems also move WARNINGS and NOTES to last. The
311 order given above should be reasonable for most purposes.
312 .PP
313 Some systems use CONFORMING TO to note conformance to relevant standards
314 and MT\-LEVEL to note safeness for use in threaded programs or signal
315 handlers. These headings are primarily useful when documenting parts of a
316 C library.
317 .PP
318 Finally, as a general note, try not to use an excessive amount of markup.
319 As documented here and in Pod::Man, you can safely leave Perl
320 variables, function names, man page references, and the like unadorned by
321 markup and the POD translators will figure it out for you. This makes it
322 much easier to later edit the documentation. Note that many existing
323 translators will do the wrong thing with e\-mail addresses when wrapped in
324 L<>, so don\*(Aqt do that.
325 .SH AUTHOR
326 .IX Header "AUTHOR"
327 Russ Allbery <[email protected]>, with large portions of this documentation
328 taken from the documentation of the original \fBpod2man\fR implementation by
329 Larry Wall and Tom Christiansen.
330 .SH "COPYRIGHT AND LICENSE"
331 .IX Header "COPYRIGHT AND LICENSE"
332 Copyright 1999, 2000, 2001, 2004, 2006, 2008, 2010, 2015, 2018 Russ
333 Allbery <[email protected]>
334 .PP
335 Copying and distribution of this file, with or without modification, are
336 permitted in any medium without royalty provided the copyright notice and
337 this notice are preserved. This file is offered as\-is, without any
338 warranty.
339 .PP
340 SPDX\-License\-Identifier: FSFAP
341 .SH "SEE ALSO"
342 .IX Header "SEE ALSO"
343 For additional information that may be more accurate for your specific
344 system, see either \fBman\fR\|(5) or \fBman\fR\|(7) depending on your system manual
345 section numbering conventions.
346 .PP
347 This documentation is maintained as part of the podlators distribution.
348 The current version is always available from its web site at
349 <https://www.eyrie.org/~eagle/software/podlators/>.