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