| 1 |
|
|---|
| 2 | =for comment
|
|---|
| 3 | This document is in Pod format. To read this, use a Pod formatter,
|
|---|
| 4 | like "perldoc perlpod".
|
|---|
| 5 |
|
|---|
| 6 | =head1 NAME
|
|---|
| 7 | X<POD> X<plain old documentation>
|
|---|
| 8 |
|
|---|
| 9 | perlpod - the Plain Old Documentation format
|
|---|
| 10 |
|
|---|
| 11 | =head1 DESCRIPTION
|
|---|
| 12 |
|
|---|
| 13 | Pod is a simple-to-use markup language used for writing documentation
|
|---|
| 14 | for Perl, Perl programs, and Perl modules.
|
|---|
| 15 |
|
|---|
| 16 | Translators are available for converting Pod to various formats
|
|---|
| 17 | like plain text, HTML, man pages, and more.
|
|---|
| 18 |
|
|---|
| 19 | Pod markup consists of three basic kinds of paragraphs:
|
|---|
| 20 | L<ordinary|/"Ordinary Paragraph">,
|
|---|
| 21 | L<verbatim|/"Verbatim Paragraph">, and
|
|---|
| 22 | L<command|/"Command Paragraph">.
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 | =head2 Ordinary Paragraph
|
|---|
| 26 | X<POD, ordinary paragraph>
|
|---|
| 27 |
|
|---|
| 28 | Most paragraphs in your documentation will be ordinary blocks
|
|---|
| 29 | of text, like this one. You can simply type in your text without
|
|---|
| 30 | any markup whatsoever, and with just a blank line before and
|
|---|
| 31 | after. When it gets formatted, it will undergo minimal formatting,
|
|---|
| 32 | like being rewrapped, probably put into a proportionally spaced
|
|---|
| 33 | font, and maybe even justified.
|
|---|
| 34 |
|
|---|
| 35 | You can use formatting codes in ordinary paragraphs, for B<bold>,
|
|---|
| 36 | I<italic>, C<code-style>, L<hyperlinks|perlfaq>, and more. Such
|
|---|
| 37 | codes are explained in the "L<Formatting Codes|/"Formatting Codes">"
|
|---|
| 38 | section, below.
|
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 | =head2 Verbatim Paragraph
|
|---|
| 42 | X<POD, verbatim paragraph> X<verbatim>
|
|---|
| 43 |
|
|---|
| 44 | Verbatim paragraphs are usually used for presenting a codeblock or
|
|---|
| 45 | other text which does not require any special parsing or formatting,
|
|---|
| 46 | and which shouldn't be wrapped.
|
|---|
| 47 |
|
|---|
| 48 | A verbatim paragraph is distinguished by having its first character
|
|---|
| 49 | be a space or a tab. (And commonly, all its lines begin with spaces
|
|---|
| 50 | and/or tabs.) It should be reproduced exactly, with tabs assumed to
|
|---|
| 51 | be on 8-column boundaries. There are no special formatting codes,
|
|---|
| 52 | so you can't italicize or anything like that. A \ means \, and
|
|---|
| 53 | nothing else.
|
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 | =head2 Command Paragraph
|
|---|
| 57 | X<POD, command>
|
|---|
| 58 |
|
|---|
| 59 | A command paragraph is used for special treatment of whole chunks
|
|---|
| 60 | of text, usually as headings or parts of lists.
|
|---|
| 61 |
|
|---|
| 62 | All command paragraphs (which are typically only one line long) start
|
|---|
| 63 | with "=", followed by an identifier, followed by arbitrary text that
|
|---|
| 64 | the command can use however it pleases. Currently recognized commands
|
|---|
| 65 | are
|
|---|
| 66 |
|
|---|
| 67 | =pod
|
|---|
| 68 | =head1 Heading Text
|
|---|
| 69 | =head2 Heading Text
|
|---|
| 70 | =head3 Heading Text
|
|---|
| 71 | =head4 Heading Text
|
|---|
| 72 | =over indentlevel
|
|---|
| 73 | =item stuff
|
|---|
| 74 | =back
|
|---|
| 75 | =begin format
|
|---|
| 76 | =end format
|
|---|
| 77 | =for format text...
|
|---|
| 78 | =encoding type
|
|---|
| 79 | =cut
|
|---|
| 80 |
|
|---|
| 81 | To explain them each in detail:
|
|---|
| 82 |
|
|---|
| 83 | =over
|
|---|
| 84 |
|
|---|
| 85 | =item C<=head1 I<Heading Text>>
|
|---|
| 86 | X<=head1> X<=head2> X<=head3> X<=head4>
|
|---|
| 87 | X<head1> X<head2> X<head3> X<head4>
|
|---|
| 88 |
|
|---|
| 89 | =item C<=head2 I<Heading Text>>
|
|---|
| 90 |
|
|---|
| 91 | =item C<=head3 I<Heading Text>>
|
|---|
| 92 |
|
|---|
| 93 | =item C<=head4 I<Heading Text>>
|
|---|
| 94 |
|
|---|
| 95 | Head1 through head4 produce headings, head1 being the highest
|
|---|
| 96 | level. The text in the rest of this paragraph is the content of the
|
|---|
| 97 | heading. For example:
|
|---|
| 98 |
|
|---|
| 99 | =head2 Object Attributes
|
|---|
| 100 |
|
|---|
| 101 | The text "Object Attributes" comprises the heading there. (Note that
|
|---|
| 102 | head3 and head4 are recent additions, not supported in older Pod
|
|---|
| 103 | translators.) The text in these heading commands can use
|
|---|
| 104 | formatting codes, as seen here:
|
|---|
| 105 |
|
|---|
| 106 | =head2 Possible Values for C<$/>
|
|---|
| 107 |
|
|---|
| 108 | Such commands are explained in the
|
|---|
| 109 | "L<Formatting Codes|/"Formatting Codes">" section, below.
|
|---|
| 110 |
|
|---|
| 111 | =item C<=over I<indentlevel>>
|
|---|
| 112 | X<=over> X<=item> X<=back> X<over> X<item> X<back>
|
|---|
| 113 |
|
|---|
| 114 | =item C<=item I<stuff...>>
|
|---|
| 115 |
|
|---|
| 116 | =item C<=back>
|
|---|
| 117 |
|
|---|
| 118 | Item, over, and back require a little more explanation: "=over" starts
|
|---|
| 119 | a region specifically for the generation of a list using "=item"
|
|---|
| 120 | commands, or for indenting (groups of) normal paragraphs. At the end
|
|---|
| 121 | of your list, use "=back" to end it. The I<indentlevel> option to
|
|---|
| 122 | "=over" indicates how far over to indent, generally in ems (where
|
|---|
| 123 | one em is the width of an "M" in the document's base font) or roughly
|
|---|
| 124 | comparable units; if there is no I<indentlevel> option, it defaults
|
|---|
| 125 | to four. (And some formatters may just ignore whatever I<indentlevel>
|
|---|
| 126 | you provide.) In the I<stuff> in C<=item I<stuff...>>, you may
|
|---|
| 127 | use formatting codes, as seen here:
|
|---|
| 128 |
|
|---|
| 129 | =item Using C<$|> to Control Buffering
|
|---|
| 130 |
|
|---|
| 131 | Such commands are explained in the
|
|---|
| 132 | "L<Formatting Codes|/"Formatting Codes">" section, below.
|
|---|
| 133 |
|
|---|
| 134 | Note also that there are some basic rules to using "=over" ...
|
|---|
| 135 | "=back" regions:
|
|---|
| 136 |
|
|---|
| 137 | =over
|
|---|
| 138 |
|
|---|
| 139 | =item *
|
|---|
| 140 |
|
|---|
| 141 | Don't use "=item"s outside of an "=over" ... "=back" region.
|
|---|
| 142 |
|
|---|
| 143 | =item *
|
|---|
| 144 |
|
|---|
| 145 | The first thing after the "=over" command should be an "=item", unless
|
|---|
| 146 | there aren't going to be any items at all in this "=over" ... "=back"
|
|---|
| 147 | region.
|
|---|
| 148 |
|
|---|
| 149 | =item *
|
|---|
| 150 |
|
|---|
| 151 | Don't put "=headI<n>" commands inside an "=over" ... "=back" region.
|
|---|
| 152 |
|
|---|
| 153 | =item *
|
|---|
| 154 |
|
|---|
| 155 | And perhaps most importantly, keep the items consistent: either use
|
|---|
| 156 | "=item *" for all of them, to produce bullets; or use "=item 1.",
|
|---|
| 157 | "=item 2.", etc., to produce numbered lists; or use "=item foo",
|
|---|
| 158 | "=item bar", etc. -- namely, things that look nothing like bullets or
|
|---|
| 159 | numbers.
|
|---|
| 160 |
|
|---|
| 161 | If you start with bullets or numbers, stick with them, as
|
|---|
| 162 | formatters use the first "=item" type to decide how to format the
|
|---|
| 163 | list.
|
|---|
| 164 |
|
|---|
| 165 | =back
|
|---|
| 166 |
|
|---|
| 167 | =item C<=cut>
|
|---|
| 168 | X<=cut> X<cut>
|
|---|
| 169 |
|
|---|
| 170 | To end a Pod block, use a blank line,
|
|---|
| 171 | then a line beginning with "=cut", and a blank
|
|---|
| 172 | line after it. This lets Perl (and the Pod formatter) know that
|
|---|
| 173 | this is where Perl code is resuming. (The blank line before the "=cut"
|
|---|
| 174 | is not technically necessary, but many older Pod processors require it.)
|
|---|
| 175 |
|
|---|
| 176 | =item C<=pod>
|
|---|
| 177 | X<=pod> X<pod>
|
|---|
| 178 |
|
|---|
| 179 | The "=pod" command by itself doesn't do much of anything, but it
|
|---|
| 180 | signals to Perl (and Pod formatters) that a Pod block starts here. A
|
|---|
| 181 | Pod block starts with I<any> command paragraph, so a "=pod" command is
|
|---|
| 182 | usually used just when you want to start a Pod block with an ordinary
|
|---|
| 183 | paragraph or a verbatim paragraph. For example:
|
|---|
| 184 |
|
|---|
| 185 | =item stuff()
|
|---|
| 186 |
|
|---|
| 187 | This function does stuff.
|
|---|
| 188 |
|
|---|
| 189 | =cut
|
|---|
| 190 |
|
|---|
| 191 | sub stuff {
|
|---|
| 192 | ...
|
|---|
| 193 | }
|
|---|
| 194 |
|
|---|
| 195 | =pod
|
|---|
| 196 |
|
|---|
| 197 | Remember to check its return value, as in:
|
|---|
| 198 |
|
|---|
| 199 | stuff() || die "Couldn't do stuff!";
|
|---|
| 200 |
|
|---|
| 201 | =cut
|
|---|
| 202 |
|
|---|
| 203 | =item C<=begin I<formatname>>
|
|---|
| 204 | X<=begin> X<=end> X<=for> X<begin> X<end> X<for>
|
|---|
| 205 |
|
|---|
| 206 | =item C<=end I<formatname>>
|
|---|
| 207 |
|
|---|
| 208 | =item C<=for I<formatname> I<text...>>
|
|---|
| 209 |
|
|---|
| 210 | For, begin, and end will let you have regions of text/code/data that
|
|---|
| 211 | are not generally interpreted as normal Pod text, but are passed
|
|---|
| 212 | directly to particular formatters, or are otherwise special. A
|
|---|
| 213 | formatter that can use that format will use the region, otherwise it
|
|---|
| 214 | will be completely ignored.
|
|---|
| 215 |
|
|---|
| 216 | A command "=begin I<formatname>", some paragraphs, and a
|
|---|
| 217 | command "=end I<formatname>", mean that the text/data inbetween
|
|---|
| 218 | is meant for formatters that understand the special format
|
|---|
| 219 | called I<formatname>. For example,
|
|---|
| 220 |
|
|---|
| 221 | =begin html
|
|---|
| 222 |
|
|---|
| 223 | <hr> <img src="thang.png">
|
|---|
| 224 | <p> This is a raw HTML paragraph </p>
|
|---|
| 225 |
|
|---|
| 226 | =end html
|
|---|
| 227 |
|
|---|
| 228 | The command "=for I<formatname> I<text...>"
|
|---|
|
|---|