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