The name of the program being documented is conventionally written in bold (using B<>) wherever it occurs, as are all program options. Arguments should be written in italics (I<>). Function names are traditionally written in italics; if you write a function as function(), Pod::Man will take care of this for you. Literal code or commands should be in C<>. References to other man pages should be in the form "manpage(section)" or "L<manpage(section)>", and Pod::Man will automatically format those appropriately. The second form, with L<>, is used to request that a POD formatter make a link to the man page if possible. As an exception, one normally omits the section when referring to module documentation since it's not clear what section module documentation will be 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 that cross-referencing tools can provide the user with links and the like. It's possible to overdo this, though, so be careful not to clutter your documentation with too much markup. References to other programs that are not given as man page references should be enclosed in B<>.
The major headers should be set out using a "=head1" directive, and are historically written in the rather startling ALL UPPER CASE format; this is not mandatory, but it's strongly recommended so that 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:
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.
=head2 Normal Usage =head2 Advanced Features =head2 Writing Configuration Files
or whatever is appropriate for your documentation.
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.
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. For example, since --section can also be written as -s, the above would be:
=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.
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) aren't very useful.
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.
=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.
Copyright YEAR(s) YOUR NAME(s)
(No, (C) is not needed. No, ``all rights reserved'' is not needed.)
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 or a requirement, you are of course free to choose any licensing.
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.
Section ordering varies, although NAME must always be the first section (you'll break some man page systems otherwise), and NAME, SYNOPSIS, DESCRIPTION, and OPTIONS generally always occur first and in that order if present. In general, SEE ALSO, AUTHOR, and similar material should be left for last. Some systems also move WARNINGS and NOTES to last. The order given above should be reasonable for most purposes.
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. This makes it much easier to later edit the documentation. Note that many existing translators will do the wrong thing with e-mail addresses when wrapped in L<>, so don't do that.
This documentation is maintained as part of the podlators distribution. The current version is always available from its web site at <http://www.eyrie.org/~eagle/software/podlators/>.
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.