| 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 "PERLPOD 1" |
| 58 |
.TH PERLPOD 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 |
perlpod \- the Plain Old Documentation format |
| 65 |
.IX Xref "POD plain old documentation" |
| 66 |
.SH DESCRIPTION |
| 67 |
.IX Header "DESCRIPTION" |
| 68 |
Pod is a simple-to-use markup language used for writing documentation |
| 69 |
for Perl, Perl programs, and Perl modules. |
| 70 |
.PP |
| 71 |
Translators are available for converting Pod to various formats |
| 72 |
like plain text, HTML, man pages, and more. |
| 73 |
.PP |
| 74 |
Pod markup consists of three basic kinds of paragraphs: |
| 75 |
ordinary, |
| 76 |
verbatim, and |
| 77 |
command. |
| 78 |
.SS "Ordinary Paragraph" |
| 79 |
.IX Xref "POD, ordinary paragraph" |
| 80 |
.IX Subsection "Ordinary Paragraph" |
| 81 |
Most paragraphs in your documentation will be ordinary blocks |
| 82 |
of text, like this one. You can simply type in your text without |
| 83 |
any markup whatsoever, and with just a blank line before and |
| 84 |
after. When it gets formatted, it will undergo minimal formatting, |
| 85 |
like being rewrapped, probably put into a proportionally spaced |
| 86 |
font, and maybe even justified. |
| 87 |
.PP |
| 88 |
You can use formatting codes in ordinary paragraphs, for \fBbold\fR, |
| 89 |
\&\fIitalic\fR, \f(CW\*(C`code\-style\*(C'\fR, hyperlinks, and more. Such |
| 90 |
codes are explained in the "Formatting Codes" |
| 91 |
section, below. |
| 92 |
.SS "Verbatim Paragraph" |
| 93 |
.IX Xref "POD, verbatim paragraph verbatim" |
| 94 |
.IX Subsection "Verbatim Paragraph" |
| 95 |
Verbatim paragraphs are usually used for presenting a codeblock or |
| 96 |
other text which does not require any special parsing or formatting, |
| 97 |
and which shouldn't be wrapped. |
| 98 |
.PP |
| 99 |
A verbatim paragraph is distinguished by having its first character |
| 100 |
be a space or a tab. (And commonly, all its lines begin with spaces |
| 101 |
and/or tabs.) It should be reproduced exactly, with tabs assumed to |
| 102 |
be on 8\-column boundaries. There are no special formatting codes, |
| 103 |
so you can't italicize or anything like that. A \e means \e, and |
| 104 |
nothing else. |
| 105 |
.SS "Command Paragraph" |
| 106 |
.IX Xref "POD, command" |
| 107 |
.IX Subsection "Command Paragraph" |
| 108 |
A command paragraph is used for special treatment of whole chunks |
| 109 |
of text, usually as headings or parts of lists. |
| 110 |
.PP |
| 111 |
All command paragraphs (which are typically only one line long) start |
| 112 |
with "=", followed by an identifier, followed by arbitrary text that |
| 113 |
the command can use however it pleases. Currently recognized commands |
| 114 |
are |
| 115 |
.PP |
| 116 |
.Vb 10 |
| 117 |
\& =pod |
| 118 |
\& =head1 Heading Text |
| 119 |
\& =head2 Heading Text |
| 120 |
\& =head3 Heading Text |
| 121 |
\& =head4 Heading Text |
| 122 |
\& =head5 Heading Text |
| 123 |
\& =head6 Heading Text |
| 124 |
\& =over indentlevel |
| 125 |
\& =item stuff |
| 126 |
\& =back |
| 127 |
\& =begin format |
| 128 |
\& =end format |
| 129 |
\& =for format text... |
| 130 |
\& =encoding type |
| 131 |
\& =cut |
| 132 |
.Ve |
| 133 |
.PP |
| 134 |
To explain them each in detail: |
| 135 |
.ie n .IP """=head1 \fIHeading Text\fR""" 4 |
| 136 |
.el .IP "\f(CW=head1 \fR\f(CIHeading Text\fR\f(CW\fR" 4 |
| 137 |
.IX Xref "=head1 =head2 =head3 =head4 =head5 =head6 head1 head2 head3 head4 head5 head6" |
| 138 |
.IX Item "=head1 Heading Text" |
| 139 |
.PD 0 |
| 140 |
.ie n .IP """=head2 \fIHeading Text\fR""" 4 |
| 141 |
.el .IP "\f(CW=head2 \fR\f(CIHeading Text\fR\f(CW\fR" 4 |
| 142 |
.IX Item "=head2 Heading Text" |
| 143 |
.ie n .IP """=head3 \fIHeading Text\fR""" 4 |
| 144 |
.el .IP "\f(CW=head3 \fR\f(CIHeading Text\fR\f(CW\fR" 4 |
| 145 |
.IX Item "=head3 Heading Text" |
| 146 |
.ie n .IP """=head4 \fIHeading Text\fR""" 4 |
| 147 |
.el .IP "\f(CW=head4 \fR\f(CIHeading Text\fR\f(CW\fR" 4 |
| 148 |
.IX Item "=head4 Heading Text" |
| 149 |
.ie n .IP """=head5 \fIHeading Text\fR""" 4 |
| 150 |
.el .IP "\f(CW=head5 \fR\f(CIHeading Text\fR\f(CW\fR" 4 |
| 151 |
.IX Item "=head5 Heading Text" |
| 152 |
.ie n .IP """=head6 \fIHeading Text\fR""" 4 |
| 153 |
.el .IP "\f(CW=head6 \fR\f(CIHeading Text\fR\f(CW\fR" 4 |
| 154 |
.IX Item "=head6 Heading Text" |
| 155 |
.PD |
| 156 |
Head1 through head6 produce headings, head1 being the highest |
| 157 |
level. The text in the rest of this paragraph is the content of the |
| 158 |
heading. For example: |
| 159 |
.Sp |
| 160 |
.Vb 1 |
| 161 |
\& =head2 Object Attributes |
| 162 |
.Ve |
| 163 |
.Sp |
| 164 |
The text "Object Attributes" comprises the heading there. |
| 165 |
The text in these heading commands can use formatting codes, as seen here: |
| 166 |
.Sp |
| 167 |
.Vb 1 |
| 168 |
\& =head2 Possible Values for C<$/> |
| 169 |
.Ve |
| 170 |
.Sp |
| 171 |
Such commands are explained in the |
| 172 |
"Formatting Codes" section, below. |
| 173 |
.Sp |
| 174 |
Note that \f(CW\*(C`head5\*(C'\fR and \f(CW\*(C`head6\*(C'\fR were introduced in 2020 and in |
| 175 |
Pod::Simple 3.41, released in October 2020, so they might not be |
| 176 |
supported on the Pod parser you use. |
| 177 |
.ie n .IP """=over \fIindentlevel\fR""" 4 |
| 178 |
.el .IP "\f(CW=over \fR\f(CIindentlevel\fR\f(CW\fR" 4 |
| 179 |
.IX Xref "=over =item =back over item back" |
| 180 |
.IX Item "=over indentlevel" |
| 181 |
.PD 0 |
| 182 |
.ie n .IP """=item \fIstuff...\fR""" 4 |
| 183 |
.el .IP "\f(CW=item \fR\f(CIstuff...\fR\f(CW\fR" 4 |
| 184 |
.IX Item "=item stuff..." |
| 185 |
.ie n .IP """=back""" 4 |
| 186 |
.el .IP \f(CW=back\fR 4 |
| 187 |
.IX Item "=back" |
| 188 |
.PD |
| 189 |
Item, over, and back require a little more explanation: "=over" starts |
| 190 |
a region specifically for the generation of a list using "=item" |
| 191 |
commands, or for indenting (groups of) normal paragraphs. At the end |
| 192 |
of your list, use "=back" to end it. The \fIindentlevel\fR option to |
| 193 |
"=over" indicates how far over to indent, generally in ems (where |
| 194 |
one em is the width of an "M" in the document's base font) or roughly |
| 195 |
comparable units; if there is no \fIindentlevel\fR option, it defaults |
| 196 |
to four. (And some formatters may just ignore whatever \fIindentlevel\fR |
| 197 |
you provide.) In the \fIstuff\fR in \f(CW\*(C`=item \fR\f(CIstuff...\fR\f(CW\*(C'\fR, you may |
| 198 |
use formatting codes, as seen here: |
| 199 |
.Sp |
| 200 |
.Vb 1 |
| 201 |
\& =item Using C<$|> to Control Buffering |
| 202 |
.Ve |
| 203 |
.Sp |
| 204 |
Such commands are explained in the |
| 205 |
"Formatting Codes" section, below. |
| 206 |
.Sp |
| 207 |
Note also that there are some basic rules to using "=over" ... |
| 208 |
"=back" regions: |
| 209 |
.RS 4 |
| 210 |
.IP \(bu 4 |
| 211 |
Don't use "=item"s outside of an "=over" ... "=back" region. |
| 212 |
.IP \(bu 4 |
| 213 |
The first thing after the "=over" command should be an "=item", unless |
| 214 |
there aren't going to be any items at all in this "=over" ... "=back" |
| 215 |
region. |
| 216 |
.IP \(bu 4 |
| 217 |
Don't put "=head\fIn\fR" commands inside an "=over" ... "=back" region. |
| 218 |
.IP \(bu 4 |
| 219 |
And perhaps most importantly, keep the items consistent: either use |
| 220 |
"=item *" for all of them, to produce bullets; or use "=item 1.", |
| 221 |
"=item 2.", etc., to produce numbered lists; or use "=item foo", |
| 222 |
"=item bar", etc.\-\-namely, things that look nothing like bullets or |
| 223 |
numbers. (If you have a list that contains both: 1) things that don't |
| 224 |
look like bullets nor numbers, plus 2) things that do, you should |
| 225 |
preface the bullet\- or number-like items with \f(CW\*(C`Z<>\*(C'\fR. See |
| 226 |
Z<> |
| 227 |
below for an example.) |
| 228 |
.Sp |
| 229 |
If you start with bullets or numbers, stick with them, as |
| 230 |
formatters use the first "=item" type to decide how to format the |
| 231 |
list. |
| 232 |
.RE |
| 233 |
.RS 4 |
| 234 |
.RE |
| 235 |
.ie n .IP """=cut""" 4 |
| 236 |
.el .IP \f(CW=cut\fR 4 |
| 237 |
.IX Xref "=cut cut" |
| 238 |
.IX Item "=cut" |
| 239 |
To end a Pod block, use a blank line, |
| 240 |
then a line beginning with "=cut", and a blank |
| 241 |
line after it. This lets Perl (and the Pod formatter) know that |
| 242 |
this is where Perl code is resuming. (The blank line before the "=cut" |
| 243 |
is not technically necessary, but many older Pod processors require it.) |
| 244 |
.ie n .IP """=pod""" 4 |
| 245 |
.el .IP \f(CW=pod\fR 4 |
| 246 |
.IX Xref "=pod pod" |
| 247 |
.IX Item "=pod" |
| 248 |
The "=pod" command by itself doesn't do much of anything, but it |
| 249 |
signals to Perl (and Pod formatters) that a Pod block starts here. A |
| 250 |
Pod block starts with \fIany\fR command paragraph, so a "=pod" command is |
| 251 |
usually used just when you want to start a Pod block with an ordinary |
| 252 |
paragraph or a verbatim paragraph. For example: |
| 253 |
.Sp |
| 254 |
.Vb 1 |
| 255 |
\& =item stuff() |
| 256 |
\& |
| 257 |
\& This function does stuff. |
| 258 |
\& |
| 259 |
\& =cut |
| 260 |
\& |
| 261 |
\& sub stuff { |
| 262 |
\& ... |
| 263 |
\& } |
| 264 |
\& |
| 265 |
\& =pod |
| 266 |
\& |
| 267 |
\& Remember to check its return value, as in: |
| 268 |
\& |
| 269 |
\& stuff() || die "Couldn\*(Aqt do stuff!"; |
| 270 |
\& |
| 271 |
\& =cut |
| 272 |
.Ve |
| 273 |
.ie n .IP """=begin \fIformatname\fR""" 4 |
| 274 |
.el .IP "\f(CW=begin \fR\f(CIformatname\fR\f(CW\fR" 4 |
| 275 |
.IX Xref "=begin =end =for begin end for" |
| 276 |
.IX Item "=begin formatname" |
| 277 |
.PD 0 |
| 278 |
.ie n .IP """=end \fIformatname\fR""" 4 |
| 279 |
.el .IP "\f(CW=end \fR\f(CIformatname\fR\f(CW\fR" 4 |
| 280 |
.IX Item "=end formatname" |
| 281 |
.ie n .IP """=for \fIformatname\fR \fItext...\fR""" 4 |
| 282 |
.el .IP "\f(CW=for \fR\f(CIformatname\fR\f(CW \fR\f(CItext...\fR\f(CW\fR" 4 |
| 283 |
.IX Item "=for formatname text..." |
| 284 |
.PD |
| 285 |
For, begin, and end will let you have regions of text/code/data that |
| 286 |
are not generally interpreted as normal Pod text, but are passed |
| 287 |
directly to particular formatters, or are otherwise special. A |
| 288 |
formatter that can use that format will use the region, otherwise it |
| 289 |
will be completely ignored. |
| 290 |
.Sp |
| 291 |
A command "=begin \fIformatname\fR", some paragraphs, and a |
| 292 |
command "=end \fIformatname\fR", mean that the text/data in between |
| 293 |
is meant for formatters that understand the special format |
| 294 |
called \fIformatname\fR. For example, |
| 295 |
.Sp |
| 296 |
.Vb 1 |
| 297 |
\& =begin html |
| 298 |
\& |
| 299 |
\& <hr> <img src="thang.png"> |
| 300 |
\& <p> This is a raw HTML paragraph </p> |
| 301 |
\& |
| 302 |
\& =end html |
| 303 |
.Ve |
| 304 |
.Sp |
| 305 |
The command "=for \fIformatname\fR \fItext...\fR" |
| 306 |
specifies that the remainder of just this paragraph (starting |
| 307 |
right after \fIformatname\fR) is in that special format. |
| 308 |
.Sp |
| 309 |
.Vb 2 |
| 310 |
\& =for html <hr> <img src="thang.png"> |
| 311 |
\& <p> This is a raw HTML paragraph </p> |
| 312 |
.Ve |
| 313 |
.Sp |
| 314 |
This means the same thing as the above "=begin html" ... "=end html" |
| 315 |
region. |
| 316 |
.Sp |
| 317 |
That is, with "=for", you can have only one paragraph's worth |
| 318 |
of text (i.e., the text in "=foo targetname text..."), but with |
| 319 |
"=begin targetname" ... "=end targetname", you can have any amount |
| 320 |
of stuff in between. (Note that there still must be a blank line |
| 321 |
after the "=begin" command and a blank line before the "=end" |
| 322 |
command.) |
| 323 |
.Sp |
| 324 |
Here are some examples of how to use these: |
| 325 |
.Sp |
| 326 |
.Vb 1 |
| 327 |
\& =begin html |
| 328 |
\& |
| 329 |
\& <br>Figure 1.<br><IMG SRC="figure1.png"><br> |
| 330 |
\& |
| 331 |
\& =end html |
| 332 |
\& |
| 333 |
\& =begin text |
| 334 |
\& |
| 335 |
\& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\- |
| 336 |
\& | foo | |
| 337 |
\& | bar | |
| 338 |
\& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\- |
| 339 |
\& |
| 340 |
\& ^^^^ Figure 1. ^^^^ |
| 341 |
\& |
| 342 |
\& =end text |
| 343 |
.Ve |
| 344 |
.Sp |
| 345 |
Some format names that formatters currently are known to accept |
| 346 |
include "roff", "man", "latex", "tex", "text", and "html". (Some |
| 347 |
formatters will treat some of these as synonyms.) |
| 348 |
.Sp |
| 349 |
A format name of "comment" is common for just making notes (presumably |
| 350 |
to yourself) that won't appear in any formatted version of the Pod |
| 351 |
document: |
| 352 |
.Sp |
| 353 |
.Vb 2 |
| 354 |
\& =for comment |
| 355 |
\& Make sure that all the available options are documented! |
| 356 |
.Ve |
| 357 |
.Sp |
| 358 |
Some \fIformatnames\fR will require a leading colon (as in |
| 359 |
\&\f(CW"=for :formatname"\fR, or |
| 360 |
\&\f(CW"=begin :formatname" ... "=end :formatname"\fR), |
| 361 |
to signal that the text is not raw data, but instead \fIis\fR Pod text |
| 362 |
(i.e., possibly containing formatting codes) that's just not for |
| 363 |
normal formatting (e.g., may not be a normal-use paragraph, but might |
| 364 |
be for formatting as a footnote). |
| 365 |
.ie n .IP """=encoding \fIencodingname\fR""" 4 |
| 366 |
.el .IP "\f(CW=encoding \fR\f(CIencodingname\fR\f(CW\fR" 4 |
| 367 |
.IX Xref "=encoding encoding" |
| 368 |
.IX Item "=encoding encodingname" |
| 369 |
This command is used for declaring the encoding of a document. Most |
| 370 |
users won't need this; but if your encoding isn't US-ASCII, |
| 371 |
then put a \f(CW\*(C`=encoding \fR\f(CIencodingname\fR\f(CW\*(C'\fR command very early in the document so |
| 372 |
that pod formatters will know how to decode the document. For |
| 373 |
\&\fIencodingname\fR, use a name recognized by the Encode::Supported |
| 374 |
module. Some pod formatters may try to guess between a Latin\-1 or |
| 375 |
CP\-1252 versus |
| 376 |
UTF\-8 encoding, but they may guess wrong. It's best to be explicit if |
| 377 |
you use anything besides strict ASCII. Examples: |
| 378 |
.Sp |
| 379 |
.Vb 1 |
| 380 |
\& =encoding latin1 |
| 381 |
\& |
| 382 |
\& =encoding utf8 |
| 383 |
\& |
| 384 |
\& =encoding koi8\-r |
| 385 |
\& |
| 386 |
\& =encoding ShiftJIS |
| 387 |
\& |
| 388 |
\& =encoding big5 |
| 389 |
.Ve |
| 390 |
.Sp |
| 391 |
\&\f(CW\*(C`=encoding\*(C'\fR affects the whole document, and must occur only once. |
| 392 |
.PP |
| 393 |
And don't forget, all commands but \f(CW\*(C`=encoding\*(C'\fR last up |
| 394 |
until the end of its \fIparagraph\fR, not its line. So in the |
| 395 |
examples below, you can see that every command needs the blank |
| 396 |
line after it, to end its paragraph. (And some older Pod translators |
| 397 |
may require the \f(CW\*(C`=encoding\*(C'\fR line to have a following blank line as |
| 398 |
well, even though it should be legal to omit.) |
| 399 |
.PP |
| 400 |
Some examples of lists include: |
| 401 |
.PP |
| 402 |
.Vb 1 |
| 403 |
\& =over |
| 404 |
\& |
| 405 |
\& =item * |
| 406 |
\& |
| 407 |
\& First item |
| 408 |
\& |
| 409 |
\& =item * |
| 410 |
\& |
| 411 |
\& Second item |
| 412 |
\& |
| 413 |
\& =back |
| 414 |
\& |
| 415 |
\& =over |
| 416 |
\& |
| 417 |
\& =item Foo() |
| 418 |
\& |
| 419 |
\& Description of Foo function |
| 420 |
\& |
| 421 |
\& =item Bar() |
| 422 |
\& |
| 423 |
\& Description of Bar function |
| 424 |
\& |
| 425 |
\& =back |
| 426 |
.Ve |
| 427 |
.SS "Formatting Codes" |
| 428 |
.IX Xref "POD, formatting code formatting code POD, interior sequence interior sequence" |
| 429 |
.IX Subsection "Formatting Codes" |
| 430 |
In ordinary paragraphs and in some command paragraphs, various |
| 431 |
formatting codes (a.k.a. "interior sequences") can be used: |
| 432 |
.ie n .IP """I<text>"" \-\- italic text" 4 |
| 433 |
.el .IP "\f(CWI<text>\fR \-\- italic text" 4 |
| 434 |
.IX Xref "I I<> POD, formatting code, italic italic" |
| 435 |
.IX Item "I<text> -- italic text" |
| 436 |
Used for emphasis ("\f(CW\*(C`be I<careful!>\*(C'\fR") and parameters |
| 437 |
("\f(CW\*(C`redo I<LABEL>\*(C'\fR") |
| 438 |
.ie n .IP """B<text>"" \-\- bold text" 4 |
| 439 |
.el .IP "\f(CWB<text>\fR \-\- bold text" 4 |
| 440 |
.IX Xref "B B<> POD, formatting code, bold bold" |
| 441 |
.IX Item "B<text> -- bold text" |
| 442 |
Used for switches ("\f(CW\*(C`perl\*(Aqs B<\-n> switch\*(C'\fR"), programs |
| 443 |
("\f(CW\*(C`some systems provide a B<chfn> for that\*(C'\fR"), |
| 444 |
emphasis ("\f(CW\*(C`be B<careful!>\*(C'\fR"), and so on |
| 445 |
("\f(CW\*(C`and that feature is known as B<autovivification>\*(C'\fR"). |
| 446 |
.ie n .IP """C<code>"" \-\- code text" 4 |
| 447 |
.el .IP "\f(CWC<code>\fR \-\- code text" 4 |
| 448 |
.IX Xref "C C<> POD, formatting code, code code" |
| 449 |
.IX Item "C<code> -- code text" |
| 450 |
Renders code in a typewriter font, or gives some other indication that |
| 451 |
this represents program text ("\f(CW\*(C`C<gmtime($^T)>\*(C'\fR") or some other |
| 452 |
form of computerese ("\f(CW\*(C`C<drwxr\-xr\-x>\*(C'\fR"). |
| 453 |
.ie n .IP """L<name>"" \-\- a hyperlink" 4 |
| 454 |
.el .IP "\f(CWL<name>\fR \-\- a hyperlink" 4 |
| 455 |
.IX Xref "L L<> POD, formatting code, hyperlink hyperlink" |
| 456 |
.IX Item "L<name> -- a hyperlink" |
| 457 |
There are various syntaxes, listed below. In the syntaxes given, |
| 458 |
\&\f(CW\*(C`text\*(C'\fR, \f(CW\*(C`name\*(C'\fR, and \f(CW\*(C`section\*(C'\fR cannot contain the characters |
| 459 |
\&'/' and '|'; and any '<' or '>' should be matched. |
| 460 |
.RS 4 |
| 461 |
.IP \(bu 4 |
| 462 |
\&\f(CW\*(C`L<name>\*(C'\fR |
| 463 |
.Sp |
| 464 |
Link to a Perl manual page (e.g., \f(CW\*(C`L<Net::Ping>\*(C'\fR). Note |
| 465 |
that \f(CW\*(C`name\*(C'\fR should not contain spaces. This syntax |
| 466 |
is also occasionally used for references to Unix man pages, as in |
| 467 |
\&\f(CW\*(C`L<crontab(5)>\*(C'\fR. |
| 468 |
.IP \(bu 4 |
| 469 |
\&\f(CW\*(C`L<name/"sec">\*(C'\fR or \f(CW\*(C`L<name/sec>\*(C'\fR |
| 470 |
.Sp |
| 471 |
Link to a section in other manual page. E.g., |
| 472 |
\&\f(CW\*(C`L<perlsyn/"For Loops">\*(C'\fR |
| 473 |
.IP \(bu 4 |
| 474 |
\&\f(CW\*(C`L</"sec">\*(C'\fR or \f(CW\*(C`L</sec>\*(C'\fR |
| 475 |
.Sp |
| 476 |
Link to a section in this manual page. E.g., |
| 477 |
\&\f(CW\*(C`L</"Object Methods">\*(C'\fR |
| 478 |
.RE |
| 479 |
.RS 4 |
| 480 |
.Sp |
| 481 |
A section is started by the named heading or item. For |
| 482 |
example, \f(CW\*(C`L<perlvar/$.>\*(C'\fR or \f(CW\*(C`L<perlvar/"$.">\*(C'\fR both |
| 483 |
link to the section started by "\f(CW\*(C`=item $.\*(C'\fR" in perlvar. And |
| 484 |
\&\f(CW\*(C`L<perlsyn/For Loops>\*(C'\fR or \f(CW\*(C`L<perlsyn/"For Loops">\*(C'\fR |
| 485 |
both link to the section started by "\f(CW\*(C`=head2 For Loops\*(C'\fR" |
| 486 |
in perlsyn. |
| 487 |
.Sp |
| 488 |
To control what text is used for display, you |
| 489 |
use "\f(CW\*(C`L<text|...>\*(C'\fR", as in: |
| 490 |
.IP \(bu 4 |
| 491 |
\&\f(CW\*(C`L<text|name>\*(C'\fR |
| 492 |
.Sp |
| 493 |
Link this text to that manual page. E.g., |
| 494 |
\&\f(CW\*(C`L<Perl Error Messages|perldiag>\*(C'\fR |
| 495 |
.IP \(bu 4 |
| 496 |
\&\f(CW\*(C`L<text|name/"sec">\*(C'\fR or \f(CW\*(C`L<text|name/sec>\*(C'\fR |
| 497 |
.Sp |
| 498 |
Link this text to that section in that manual page. E.g., |
| 499 |
\&\f(CW\*(C`L<postfix "if"|perlsyn/"Statement Modifiers">\*(C'\fR |
| 500 |
.IP \(bu 4 |
| 501 |
\&\f(CW\*(C`L<text|/"sec">\*(C'\fR or \f(CW\*(C`L<text|/sec>\*(C'\fR |
| 502 |
or \f(CW\*(C`L<text|"sec">\*(C'\fR |
| 503 |
.Sp |
| 504 |
Link this text to that section in this manual page. E.g., |
| 505 |
\&\f(CW\*(C`L<the various attributes|/"Member Data">\*(C'\fR |
| 506 |
.RE |
| 507 |
.RS 4 |
| 508 |
.Sp |
| 509 |
Or you can link to a web page: |
| 510 |
.IP \(bu 4 |
| 511 |
\&\f(CW\*(C`L<scheme:...>\*(C'\fR |
| 512 |
.Sp |
| 513 |
\&\f(CW\*(C`L<text|scheme:...>\*(C'\fR |
| 514 |
.Sp |
| 515 |
Links to an absolute URL. For example, \f(CW\*(C`L<http://www.perl.org/>\*(C'\fR or |
| 516 |
\&\f(CW\*(C`L<The Perl Home Page|http://www.perl.org/>\*(C'\fR. |
| 517 |
.RE |
| 518 |
.RS 4 |
| 519 |
.RE |
| 520 |
.ie n .IP """E<escape>"" \-\- a character escape" 4 |
| 521 |
.el .IP "\f(CWE<escape>\fR \-\- a character escape" 4 |
| 522 |
.IX Xref "E E<> POD, formatting code, escape escape" |
| 523 |
.IX Item "E<escape> -- a character escape" |
| 524 |
Very similar to HTML/XML \f(CW\*(C`&\fR\f(CIfoo\fR\f(CW;\*(C'\fR "entity references": |
| 525 |
.RS 4 |
| 526 |
.IP \(bu 4 |
| 527 |
\&\f(CW\*(C`E<lt>\*(C'\fR \-\- a literal < (less than) |
| 528 |
.IP \(bu 4 |
| 529 |
\&\f(CW\*(C`E<gt>\*(C'\fR \-\- a literal > (greater than) |
| 530 |
.IP \(bu 4 |
| 531 |
\&\f(CW\*(C`E<verbar>\*(C'\fR \-\- a literal | (\fIver\fRtical \fIbar\fR) |
| 532 |
.IP \(bu 4 |
| 533 |
\&\f(CW\*(C`E<sol>\*(C'\fR \-\- a literal / (\fIsol\fRidus) |
| 534 |
.Sp |
| 535 |
The above four are optional except in other formatting codes, |
| 536 |
notably \f(CW\*(C`L<...>\*(C'\fR, and when preceded by a |
| 537 |
capital letter. |
| 538 |
.IP \(bu 4 |
| 539 |
\&\f(CW\*(C`E<htmlname>\*(C'\fR |
| 540 |
.Sp |
| 541 |
Some non-numeric HTML entity name, such as \f(CW\*(C`E<eacute>\*(C'\fR, |
| 542 |
meaning the same thing as \f(CW\*(C`é\*(C'\fR in HTML \-\- i.e., a lowercase |
| 543 |
e with an acute (/\-shaped) accent. |
| 544 |
.IP \(bu 4 |
| 545 |
\&\f(CW\*(C`E<number>\*(C'\fR |
| 546 |
.Sp |
| 547 |
The ASCII/Latin\-1/Unicode character with that number. A |
| 548 |
leading "0x" means that \fInumber\fR is hex, as in |
| 549 |
\&\f(CW\*(C`E<0x201E>\*(C'\fR. A leading "0" means that \fInumber\fR is octal, |
| 550 |
as in \f(CW\*(C`E<075>\*(C'\fR. Otherwise \fInumber\fR is interpreted as being |
| 551 |
in decimal, as in \f(CW\*(C`E<181>\*(C'\fR. |
| 552 |
.Sp |
| 553 |
Note that older Pod formatters might not recognize octal or |
| 554 |
hex numeric escapes, and that many formatters cannot reliably |
| 555 |
render characters above 255. (Some formatters may even have |
| 556 |
to use compromised renderings of Latin\-1/CP\-1252 characters, like |
| 557 |
rendering \f(CW\*(C`E<eacute>\*(C'\fR as just a plain "e".) |
| 558 |
.RE |
| 559 |
.RS 4 |
| 560 |
.RE |
| 561 |
.ie n .IP """F<filename>"" \-\- used for filenames" 4 |
| 562 |
.el .IP "\f(CWF<filename>\fR \-\- used for filenames" 4 |
| 563 |
.IX Xref "F F<> POD, formatting code, filename filename" |
| 564 |
.IX Item "F<filename> -- used for filenames" |
| 565 |
Typically displayed in italics. Example: "\f(CW\*(C`F<.cshrc>\*(C'\fR" |
| 566 |
.ie n .IP """S<text>"" \-\- text contains non-breaking spaces" 4 |
| 567 |
.el .IP "\f(CWS<text>\fR \-\- text contains non-breaking spaces" 4 |
| 568 |
.IX Xref "S S<> POD, formatting code, non-breaking space non-breaking space" |
| 569 |
.IX Item "S<text> -- text contains non-breaking spaces" |
| 570 |
This means that the words in \fItext\fR should not be broken |
| 571 |
across lines. Example: \f(CW\*(C`S<$x\ ?\ $y\ :\ $z>\*(C'\fR. |
| 572 |
.ie n .IP """X<topic name>"" \-\- an index entry" 4 |
| 573 |
.el .IP "\f(CWX<topic name>\fR \-\- an index entry" 4 |
| 574 |
.IX Xref "X X<> POD, formatting code, index entry index entry" |
| 575 |
.IX Item "X<topic name> -- an index entry" |
| 576 |
This is ignored by most formatters, but some may use it for building |
| 577 |
indexes. It always renders as empty-string. |
| 578 |
Example: \f(CW\*(C`X<absolutizing relative URLs>\*(C'\fR |
| 579 |
.ie n .IP """Z<>"" \-\- a null (zero-effect) formatting code" 4 |
| 580 |
.el .IP "\f(CWZ<>\fR \-\- a null (zero-effect) formatting code" 4 |
| 581 |
.IX Xref "Z Z<> POD, formatting code, null null" |
| 582 |
.IX Item "Z<> -- a null (zero-effect) formatting code" |
| 583 |
This is rarely used. It's one way to get around using an |
| 584 |
E<...> code sometimes. For example, instead of |
| 585 |
"\f(CW\*(C`NE<lt>3\*(C'\fR" (for "N<3") you could write |
| 586 |
"\f(CW\*(C`NZ<><3\*(C'\fR" (the "Z<>" breaks up the "N" and |
| 587 |
the "<" so they can't be considered |
| 588 |
the part of a (fictitious) "N<...>" code). |
| 589 |
.Sp |
| 590 |
Another use is to indicate that \fIstuff\fR in \f(CW\*(C`=item Z<>\fR\f(CIstuff...\fR\f(CW\*(C'\fR |
| 591 |
is not to be considered to be a bullet or number. For example, |
| 592 |
without the \f(CW\*(C`Z<>\*(C'\fR, the line |
| 593 |
.Sp |
| 594 |
.Vb 1 |
| 595 |
\& =item Z<>500 Server error |
| 596 |
.Ve |
| 597 |
.Sp |
| 598 |
could possibly be parsed as an item in a numbered list when it isn't |
| 599 |
meant to be. |
| 600 |
.Sp |
| 601 |
Still another use is to maintain visual space between \f(CW\*(C`=item\*(C'\fR lines. |
| 602 |
If you specify |
| 603 |
.Sp |
| 604 |
.Vb 1 |
| 605 |
\& =item foo |
| 606 |
\& |
| 607 |
\& =item bar |
| 608 |
.Ve |
| 609 |
.Sp |
| 610 |
it will typically get rendered as |
| 611 |
.Sp |
| 612 |
.Vb 2 |
| 613 |
\& foo |
| 614 |
\& bar |
| 615 |
.Ve |
| 616 |
.Sp |
| 617 |
That may be what you want, but if what you really want is |
| 618 |
.Sp |
| 619 |
.Vb 1 |
| 620 |
\& foo |
| 621 |
\& |
| 622 |
\& bar |
| 623 |
.Ve |
| 624 |
.Sp |
| 625 |
you can use \f(CW\*(C`Z<>\*(C'\fR to accomplish that |
| 626 |
.Sp |
| 627 |
.Vb 1 |
| 628 |
\& =item foo |
| 629 |
\& |
| 630 |
\& Z<> |
| 631 |
\& |
| 632 |
\& =item bar |
| 633 |
.Ve |
| 634 |
.PP |
| 635 |
Most of the time, you will need only a single set of angle brackets to |
| 636 |
delimit the beginning and end of formatting codes. However, |
| 637 |
sometimes you will want to put a real right angle bracket (a |
| 638 |
greater-than sign, '>') inside of a formatting code. This is particularly |
| 639 |
common when using a formatting code to provide a different font-type for a |
| 640 |
snippet of code. As with all things in Perl, there is more than |
| 641 |
one way to do it. One way is to simply escape the closing bracket |
| 642 |
using an \f(CW\*(C`E\*(C'\fR code: |
| 643 |
.PP |
| 644 |
.Vb 1 |
| 645 |
\& C<$a E<lt>=E<gt> $b> |
| 646 |
.Ve |
| 647 |
.PP |
| 648 |
This will produce: "\f(CW\*(C`$a <=> $b\*(C'\fR" |
| 649 |
.PP |
| 650 |
A more readable, and perhaps more "plain" way is to use an alternate |
| 651 |
set of delimiters that doesn't require a single ">" to be escaped. |
| 652 |
Doubled angle brackets ("<<" and ">>") may be used \fIif and only if there is |
| 653 |
whitespace right after the opening delimiter and whitespace right |
| 654 |
before the closing delimiter!\fR For example, the following will |
| 655 |
do the trick: |
| 656 |
.IX Xref "POD, formatting code, escaping with multiple brackets" |
| 657 |
.PP |
| 658 |
.Vb 1 |
| 659 |
\& C<< $a <=> $b >> |
| 660 |
.Ve |
| 661 |
.PP |
| 662 |
In fact, you can use as many repeated angle-brackets as you like so |
| 663 |
long as you have the same number of them in the opening and closing |
| 664 |
delimiters, and make sure that whitespace immediately follows the last |
| 665 |
\&'<' of the opening delimiter, and immediately precedes the first '>' |
| 666 |
of the closing delimiter. (The whitespace is ignored.) So the |
| 667 |
following will also work: |
| 668 |
.IX Xref "POD, formatting code, escaping with multiple brackets" |
| 669 |
.PP |
| 670 |
.Vb 2 |
| 671 |
\& C<<< $a <=> $b >>> |
| 672 |
\& C<<<< $a <=> $b >>>> |
| 673 |
.Ve |
| 674 |
.PP |
| 675 |
And they all mean exactly the same as this: |
| 676 |
.PP |
| 677 |
.Vb 1 |
| 678 |
\& C<$a E<lt>=E<gt> $b> |
| 679 |
.Ve |
| 680 |
.PP |
| 681 |
The multiple-bracket form does not affect the interpretation of the contents of |
| 682 |
the formatting code, only how it must end. That means that the examples above |
| 683 |
are also exactly the same as this: |
| 684 |
.PP |
| 685 |
.Vb 1 |
| 686 |
\& C<< $a E<lt>=E<gt> $b >> |
| 687 |
.Ve |
| 688 |
.PP |
| 689 |
As a further example, this means that if you wanted to put these bits of |
| 690 |
code in \f(CW\*(C`C\*(C'\fR (code) style: |
| 691 |
.PP |
| 692 |
.Vb 2 |
| 693 |
\& open(X, ">>thing.dat") || die $! |
| 694 |
\& $foo\->bar(); |
| 695 |
.Ve |
| 696 |
.PP |
| 697 |
you could do it like so: |
| 698 |
.PP |
| 699 |
.Vb 2 |
| 700 |
\& C<<< open(X, ">>thing.dat") || die $! >>> |
| 701 |
\& C<< $foo\->bar(); >> |
| 702 |
.Ve |
| 703 |
.PP |
| 704 |
which is presumably easier to read than the old way: |
| 705 |
.PP |
| 706 |
.Vb 2 |
| 707 |
\& C<open(X, "E<gt>E<gt>thing.dat") || die $!> |
| 708 |
\& C<$foo\-E<gt>bar();> |
| 709 |
.Ve |
| 710 |
.PP |
| 711 |
This is currently supported by pod2text (Pod::Text), pod2man (Pod::Man), |
| 712 |
and any other pod2xxx or Pod::Xxxx translators that use |
| 713 |
Pod::Parser 1.093 or later, or Pod::Tree 1.02 or later. |
| 714 |
.SS "The Intent" |
| 715 |
.IX Xref "POD, intent of" |
| 716 |
.IX Subsection "The Intent" |
| 717 |
The intent is simplicity of use, not power of expression. Paragraphs |
| 718 |
look like paragraphs (block format), so that they stand out |
| 719 |
visually, and so that I could run them through \f(CW\*(C`fmt\*(C'\fR easily to reformat |
| 720 |
them (that's F7 in my version of \fBvi\fR, or Esc Q in my version of |
| 721 |
\&\fBemacs\fR). I wanted the translator to always leave the \f(CW\*(C`\*(Aq\*(C'\fR and \f(CW\*(C`\`\*(C'\fR and |
| 722 |
\&\f(CW\*(C`"\*(C'\fR quotes alone, in verbatim mode, so I could slurp in a |
| 723 |
working program, shift it over four spaces, and have it print out, er, |
| 724 |
verbatim. And presumably in a monospace font. |
| 725 |
.PP |
| 726 |
The Pod format is not necessarily sufficient for writing a book. Pod |
| 727 |
is just meant to be an idiot-proof common source for nroff, HTML, |
| 728 |
TeX, and other markup languages, as used for online |
| 729 |
documentation. Translators exist for \fBpod2text\fR, \fBpod2html\fR, |
| 730 |
\&\fBpod2man\fR (that's for \fBnroff\fR\|(1) and \fBtroff\fR\|(1)), \fBpod2latex\fR, and |
| 731 |
\&\fBpod2fm\fR. Various others are available in CPAN. |
| 732 |
.SS "Embedding Pods in Perl Modules" |
| 733 |
.IX Xref "POD, embedding" |
| 734 |
.IX Subsection "Embedding Pods in Perl Modules" |
| 735 |
You can embed Pod documentation in your Perl modules and scripts. Start |
| 736 |
your documentation with an empty line, a "=head1" command at the |
| 737 |
beginning, and end it with a "=cut" command and an empty line. The |
| 738 |
\&\fBperl\fR executable will ignore the Pod text. You can place a Pod |
| 739 |
statement where \fBperl\fR expects the beginning of a new statement, but |
| 740 |
not within a statement, as that would result in an error. See any of |
| 741 |
the supplied library modules for examples. |
| 742 |
.PP |
| 743 |
If you're going to put your Pod at the end of the file, and you're using |
| 744 |
an \f(CW\*(C`_\|_END_\|_\*(C'\fR or \f(CW\*(C`_\|_DATA_\|_\*(C'\fR cut mark, make sure to put an empty line there |
| 745 |
before the first Pod command. |
| 746 |
.PP |
| 747 |
.Vb 1 |
| 748 |
\& _\|_END_\|_ |
| 749 |
\& |
| 750 |
\& =head1 NAME |
| 751 |
\& |
| 752 |
\& Time::Local \- efficiently compute time from local and GMT time |
| 753 |
.Ve |
| 754 |
.PP |
| 755 |
Without that empty line before the "=head1", many translators wouldn't |
| 756 |
have recognized the "=head1" as starting a Pod block. |
| 757 |
.SS "Hints for Writing Pod" |
| 758 |
.IX Subsection "Hints for Writing Pod" |
| 759 |
.IP \(bu 4 |
| 760 |
|
| 761 |
.IX Xref "podchecker POD, validating" |
| 762 |
.Sp |
| 763 |
The \fBpodchecker\fR command is provided for checking Pod syntax for errors |
| 764 |
and warnings. For example, it checks for completely blank lines in |
| 765 |
Pod blocks and for unknown commands and formatting codes. You should |
| 766 |
still also pass your document through one or more translators and proofread |
| 767 |
the result, or print out the result and proofread that. Some of the |
| 768 |
problems found may be bugs in the translators, which you may or may not |
| 769 |
wish to work around. |
| 770 |
.IP \(bu 4 |
| 771 |
If you're more familiar with writing in HTML than with writing in Pod, you |
| 772 |
can try your hand at writing documentation in simple HTML, and converting |
| 773 |
it to Pod with the experimental Pod::HTML2Pod module, |
| 774 |
(available in CPAN), and looking at the resulting code. The experimental |
| 775 |
Pod::PXML module in CPAN might also be useful. |
| 776 |
.IP \(bu 4 |
| 777 |
Many older Pod translators require the lines before every Pod |
| 778 |
command and after every Pod command (including "=cut"!) to be a blank |
| 779 |
line. Having something like this: |
| 780 |
.Sp |
| 781 |
.Vb 2 |
| 782 |
\& # \- \- \- \- \- \- \- \- \- \- \- \- |
| 783 |
\& =item $firecracker\->boom() |
| 784 |
\& |
| 785 |
\& This noisily detonates the firecracker object. |
| 786 |
\& =cut |
| 787 |
\& sub boom { |
| 788 |
\& ... |
| 789 |
.Ve |
| 790 |
.Sp |
| 791 |
\&...will make such Pod translators completely fail to see the Pod block |
| 792 |
at all. |
| 793 |
.Sp |
| 794 |
Instead, have it like this: |
| 795 |
.Sp |
| 796 |
.Vb 1 |
| 797 |
\& # \- \- \- \- \- \- \- \- \- \- \- \- |
| 798 |
\& |
| 799 |
\& =item $firecracker\->boom() |
| 800 |
\& |
| 801 |
\& This noisily detonates the firecracker object. |
| 802 |
\& |
| 803 |
\& =cut |
| 804 |
\& |
| 805 |
\& sub boom { |
| 806 |
\& ... |
| 807 |
.Ve |
| 808 |
.IP \(bu 4 |
| 809 |
Some older Pod translators require paragraphs (including command |
| 810 |
paragraphs like "=head2 Functions") to be separated by \fIcompletely\fR |
| 811 |
empty lines. If you have an apparently empty line with some spaces |
| 812 |
on it, this might not count as a separator for those translators, and |
| 813 |
that could cause odd formatting. |
| 814 |
.IP \(bu 4 |
| 815 |
Older translators might add wording around an L<> link, so that |
| 816 |
\&\f(CW\*(C`L<Foo::Bar>\*(C'\fR may become "the Foo::Bar manpage", for example. |
| 817 |
So you shouldn't write things like \f(CW\*(C`the L<foo> |
| 818 |
documentation\*(C'\fR, if you want the translated document to read sensibly. |
| 819 |
Instead, write \f(CW\*(C`the L<Foo::Bar|Foo::Bar> documentation\*(C'\fR or |
| 820 |
\&\f(CW\*(C`L<the Foo::Bar documentation|Foo::Bar>\*(C'\fR, to control how the |
| 821 |
link comes out. |
| 822 |
.IP \(bu 4 |
| 823 |
Going past the 70th column in a verbatim block might be ungracefully |
| 824 |
wrapped by some formatters. |
| 825 |
.SH "SEE ALSO" |
| 826 |
.IX Header "SEE ALSO" |
| 827 |
perlpodspec, "PODs: Embedded Documentation" in perlsyn, |
| 828 |
perlnewmod, perldoc, pod2html, pod2man, podchecker. |
| 829 |
.SH AUTHOR |
| 830 |
.IX Header "AUTHOR" |
| 831 |
Larry Wall, Sean M. Burke |