PERLPODSTYLE(1perl)
π perlpodstyle β the vibe guide to writing POD π
okay so bestie, this is perlpodstyle, and it's literally the style guide for how you write POD docs for your Perl scripts and modules. Consider it your group chat's shared aesthetic rules but for documentation. π
β¨ DESCRIPTION β¨
These are the general guidelines for how to write POD documentation for Perl scripts and modules, based on the general guidelines for writing good UNIX man pages. All of them are, of course, optional β nobody's gonna show up at your door πͺ β but following them makes your docs way more consistent with everything else on the system. It's giving cohesive brand. π
Here's the tea on formatting β:
- The name of the program you're documenting is conventionally written in bold (using
B<>) wherever it shows up β same goes for all program options. - Arguments go in italics (
I<>). - Function names are traditionally written in italics; and if you write a function as
function(),Pod::Manwill take care of that for you automatically, no cap. - Literal code or commands go in
C<>. - References to other man pages should be in the form
manpage(section)or"L<manpage(section)>", andPod::Manwill automatically format those appropriately. That second form, the one withL<>, is you asking a POD formatter to make an actual link to the man page if it can. β¨ - Exception time π¨: you normally omit the section when you're referring to module documentation, because honestly it's not clear what section module docs will end up in. Use
"L<Module::Name>"for module references instead. - References to other programs or functions are normally in the form of man page references, so cross-referencing tools can hand the user links and stuff. But you can absolutely overdo this β be careful not to clutter your docs with too much markup, bestie, chill π .
- References to other programs that aren't given as man page references should be wrapped in
B<>.
For headers: the major ones should be set out using a =head1 directive, and historically they're written in the rather startling ALL UPPER CASE format. It's not mandatory, but it's strongly recommended so sections have consistent naming across different software packages. Minor headers may be included using =head2, and are typically in mixed case.
The standard sections of a manual page are:
π NAME
Mandatory section, babes. It should be a comma-separated list of the programs or functions documented by this POD page, like:
foo, bar - programs to do something
Manual page indexers are often extremely picky about the format of this section π€, so don't put anything in it except this line. Every program or function documented by this POD page should be listed, separated by a comma and a space. For a Perl module, just give the module name. A single dash, and only a single dash, should separate the list of programs or functions from the description. Do not use any markup such as C<> or B<> anywhere in this line. Functions should not be qualified with "()" or the like. The description should ideally fit on a single line, even if a man program replaces the dash with a few tabs.
π SYNOPSIS
A short usage summary for programs and functions. This section is mandatory for section 3 pages. For Perl module documentation, it's usually convenient to have the contents of this section be a verbatim block showing some (brief) examples of typical ways the module is used. Keep it cute and short. πΈ
π DESCRIPTION
Extended description and discussion of the program or functions, or the body of the documentation for man pages that document something else. If it's particularly long, it's a good idea to break this up into subsections with =head2 directives like:
=head2 Normal Usage
=head2 Advanced Features
=head2 Writing Configuration Files
or whatever is appropriate for your documentation. Slay. π
For a module, this is generally where the documentation of the interfaces provided by the module goes, usually in the form of a list with an "=item" for each interface. Depending on how many interfaces there are, you may want to put that documentation in separate METHODS, FUNCTIONS, CLASS METHODS, or INSTANCE METHODS sections instead, and save the DESCRIPTION section for an overview. Iconic organizational behavior honestly. π
βοΈ OPTIONS
Detailed description of each of the command-line options taken by the program. This should be separate from the description, for the use of parsers like Pod::Usage. This is normally presented as a list, with each option as a separate "=item". The specific option string should be enclosed in B<>. Any values that the option takes should be enclosed in I<>. For example, the section for the option --section=manext would be introduced with:
=item B<--section>=I<manext>
Synonymous options (like both the short and long forms) are separated by a comma and a space on the same "=item" line, or optionally listed as their own item with a reference to the canonical name. So like, since --section can also be written as -s, the above would become:
=item B<-s> I<manext>, B<--section>=I<manext>
Writing the short option first is recommended because it's easier to read. The long option is long enough to draw the eye to it anyway, and the short option can otherwise get lost in visual noise. π«Ά
π RETURN VALUE
What the program or function returns, if successful. This section can be omitted for programs whose precise exit codes aren't important, provided they return 0 on success and non-zero on failure as is standard. It should always be present for functions. For modules, it may be useful to summarize return values from the module interface here, or it may be more useful to discuss return values separately in the documentation of each function or method the module provides.
π ERRORS
Exceptions, error return codes, exit statuses, and errno settings. Typically used for function or module documentation; program documentation uses DIAGNOSTICS instead. The general rule of thumb is that errors printed to "STDOUT" or "STDERR" and intended for the end user are documented in DIAGNOSTICS, while errors passed internal to the calling program and intended for other programmers are documented in ERRORS. When documenting a function that sets errno, a full list of the possible errno values should be given here. No hiding the receipts. π§Ύ
π©Ί DIAGNOSTICS
All possible messages the program can print out and what they mean. You may wish to follow the same documentation style as the Perl documentation β see perldiag(1) for more details (and look at the POD source as well π).
If applicable, please include details on what the user should do to correct the error. Documenting an error as indicating "the input buffer is too small" without telling the user how to increase the size of the input buffer (or at least telling them that it isn't possible) isn't very useful. Be a helper, not a hater. π₯Ί
π¬ EXAMPLES
Give some example uses of the program or function. Don't skimp β users often find this the most useful part of the documentation, fr fr. The examples are generally given as verbatim paragraphs.
And don't just present an example without explaining what it does. Adding a short paragraph saying what the example will do can increase the value of the example immensely. The way that one little sentence carries the whole doc ππ
π ENVIRONMENT
Environment variables that the program cares about, normally presented as a list using "=over", "=item", and "=back". For example:
=over 6
=item HOME
Used to determine the user's home directory. F<.foorc> in this
directory is read for configuration details, if it exists.
=back
Since environment variables are normally in all uppercase, no additional special formatting is generally needed; they're glaring enough as it is. π
π FILES
All files used by the program or function, normally presented as a list, and what it uses them for. File names should be enclosed in F<>. It's particularly important to document files that will be potentially modified. β οΈ
π§ CAVEATS
Things to take special care with, sometimes called WARNINGS.
π BUGS
Things that are broken or just don't work quite right. π
π« RESTRICTIONS
Bugs you don't plan to fix. :-) β¨
ποΈ NOTES
Miscellaneous commentary.
ποΈ AUTHOR
Who wrote it (use AUTHORS for multiple people). It's a good idea to include your current e-mail address (or some e-mail address to which bug reports should be sent) or some other contact information, so that users have a way of contacting you. Remember that program documentation tends to roam the wild for far longer than you expect, so pick a contact method that's likely to last. Choose your legacy wisely, bestie. π
π HISTORY
Programs derived from other sources sometimes have this. Some people keep a modification log here, but that usually gets long and is normally better maintained in a separate file.
Β©οΈ COPYRIGHT AND LICENSE
For copyright:
Copyright YEAR(s) YOUR NAME(s)
(No, (C) is not needed. No, "all rights reserved" is not needed. We're keeping it minimal. π
)
For licensing, the easiest way is to use the same licensing as Perl itself:
This library is free software; you may redistribute it and/or
modify it under the same terms as Perl itself.
This makes it easy for people to use your module with Perl. Note that this licensing example is neither an endorsement nor a requirement β you are of course free to choose any licensing. Your module, your rules. π
π SEE ALSO
Other man pages to check out, like man(1), man(7), makewhatis(8), or catman(8). Normally a simple list of man pages separated by commas, or a paragraph giving the name of a reference work. Man page references, if they use the standard name(section) form, don't have to be enclosed in L<> (although it's recommended), but other things in this section probably should be when appropriate.
If the package has a mailing list, include a URL or subscription instructions here.
If the package has a web site, include a URL here.
Documentation of object-oriented libraries or modules may want to use CONSTRUCTORS and METHODS sections, or CLASS METHODS and INSTANCE METHODS sections, for detailed documentation of the parts of the library β and save the DESCRIPTION section for an overview. Large modules with a function interface may want to use FUNCTIONS for similar reasons. Some people use OVERVIEW to summarize the description if it's quite long. π¦
okay bestie, we were mid-section β let's pick it right back up π
Section ordering varies, like honestly it's giving choose your own adventure, but NAME has got to be the first section no matter what (if you don't, you'll break some man page systems and that's not the vibe, bestie π). And NAME, SYNOPSIS, DESCRIPTION, and OPTIONS generally always show up first and in exactly that order if they're present. Periodt. π
Then like, in general, SEE ALSO, AUTHOR, and similar material should be left for last. Some systems also move WARNINGS and NOTES to last too. The order given above should be reasonable for most purposes, so you're safe fr fr. β¨
Some systems use CONFORMING TO to note conformance to relevant standards, and MT-LEVEL to note safeness for use in threaded programs or signal handlers. These headings are primarily useful when documenting parts of a C library. π«Ά
Finally, as a general note β try not to use an excessive amount of markup. As documented here and in Pod::Man, you can safely leave Perl variables, function names, man page references, and the like unadorned by markup and the POD translators will figure it out for you. That makes it so much easier to later edit the documentation. π
careful, bestie!! Note that many existing translators will do the wrong thing with e-mail addresses when wrapped in L<>, so don't do that. Not me warning you about a cursed edge case π
πΈ AUTHOR πΈ
Russ Allbery <rra@cpan.org>, with large portions of this documentation taken from the documentation of the original pod2man implementation by Larry Wall and Tom Christiansen. shoutout the OGs π
π COPYRIGHT AND LICENSE π
Copyright 1999, 2000, 2001, 2004, 2006, 2008, 2010, 2015, 2018 Russ Allbery <rra@cpan.org>
Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without any warranty.
SPDX-License-Identifier: FSFAP
π¦ SEE ALSO π¦
For additional information that may be more accurate for your specific system, see either man(5) or man(7) depending on your system manual section numbering conventions. iykyk π
This documentation is maintained as part of the podlators distribution. The current version is always available from its web site at <https://www.eyrie.org/~eagle/software/podlators/>. π
and that's a wrap on the whole page, bestie!! this one's perl v5.44.0 and it's dated 2026-10-17 β slay, iconic, go write some gorgeous man pages now π
πβ¨
π¦ where this page comes from
- arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms