This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Configure: signbit scan assuming too much
[perl5.git] / pod / perlpod.pod
index 955d706..41053af 100644 (file)
@@ -4,6 +4,7 @@ This document is in Pod format.  To read this, use a Pod formatter,
 like "perldoc perlpod".
 
 =head1 NAME
+X<POD> X<plain old documentation>
 
 perlpod - the Plain Old Documentation format
 
@@ -22,6 +23,7 @@ L<command|/"Command Paragraph">.
 
 
 =head2 Ordinary Paragraph
+X<POD, ordinary paragraph>
 
 Most paragraphs in your documentation will be ordinary blocks
 of text, like this one.  You can simply type in your text without
@@ -37,6 +39,7 @@ section, below.
 
 
 =head2 Verbatim Paragraph
+X<POD, verbatim paragraph> X<verbatim>
 
 Verbatim paragraphs are usually used for presenting a codeblock or
 other text which does not require any special parsing or formatting,
@@ -51,6 +54,7 @@ nothing else.
 
 
 =head2 Command Paragraph
+X<POD, command>
 
 A command paragraph is used for special treatment of whole chunks
 of text, usually as headings or parts of lists.
@@ -60,6 +64,7 @@ with "=", followed by an identifier, followed by arbitrary text that
 the command can use however it pleases.  Currently recognized commands
 are
 
+    =pod
     =head1 Heading Text
     =head2 Heading Text
     =head3 Heading Text
@@ -67,17 +72,19 @@ are
     =over indentlevel
     =item stuff
     =back
-    =cut
-    =pod
     =begin format
     =end format
     =for format text...
+    =encoding type
+    =cut
 
 To explain them each in detail:
 
 =over
 
 =item C<=head1 I<Heading Text>>
+X<=head1> X<=head2> X<=head3> X<=head4>
+X<head1> X<head2> X<head3> X<head4>
 
 =item C<=head2 I<Heading Text>>
 
@@ -91,10 +98,8 @@ heading.  For example:
 
   =head2 Object Attributes
 
-The text "Object Attributes" comprises the heading there.  (Note that
-head3 and head4 are recent additions, not supported in older Pod
-translators.)  The text in these heading commands can use
-formatting codes, as seen here:
+The text "Object Attributes" comprises the heading there.
+The text in these heading commands can use formatting codes, as seen here:
 
   =head2 Possible Values for C<$/>
 
@@ -102,6 +107,7 @@ Such commands are explained in the
 "L<Formatting Codes|/"Formatting Codes">" section, below.
 
 =item C<=over I<indentlevel>>
+X<=over> X<=item> X<=back> X<over> X<item> X<back>
 
 =item C<=item I<stuff...>>
 
@@ -147,7 +153,7 @@ Don't put "=headI<n>" commands inside an "=over" ... "=back" region.
 And perhaps most importantly, keep the items consistent: either use
 "=item *" for all of them, to produce bullets; or use "=item 1.",
 "=item 2.", etc., to produce numbered lists; or use "=item foo",
-"=item bar", etc. -- namely, things that look nothing like bullets or
+"=item bar", etc.--namely, things that look nothing like bullets or
 numbers.
 
 If you start with bullets or numbers, stick with them, as
@@ -157,6 +163,7 @@ list.
 =back
 
 =item C<=cut>
+X<=cut> X<cut>
 
 To end a Pod block, use a blank line,
 then a line beginning with "=cut", and a blank
@@ -165,6 +172,7 @@ this is where Perl code is resuming.  (The blank line before the "=cut"
 is not technically necessary, but many older Pod processors require it.)
 
 =item C<=pod>
+X<=pod> X<pod>
 
 The "=pod" command by itself doesn't do much of anything, but it
 signals to Perl (and Pod formatters) that a Pod block starts here.  A
@@ -191,6 +199,7 @@ paragraph or a verbatim paragraph.  For example:
   =cut
 
 =item C<=begin I<formatname>>
+X<=begin> X<=end> X<=for> X<begin> X<end> X<for>
 
 =item C<=end I<formatname>>
 
@@ -203,7 +212,7 @@ formatter that can use that format will use the region, otherwise it
 will be completely ignored.
 
 A command "=begin I<formatname>", some paragraphs, and a
-command "=end I<formatname>", mean that the text/data inbetween
+command "=end I<formatname>", mean that the text/data in between
 is meant for formatters that understand the special format
 called I<formatname>.  For example,
 
@@ -227,9 +236,9 @@ region.
 That is, with "=for", you can have only one paragraph's worth
 of text (i.e., the text in "=foo targetname text..."), but with
 "=begin targetname" ... "=end targetname", you can have any amount
-of stuff inbetween.  (Note that there still must be a blank line
+of stuff in between.  (Note that there still must be a blank line
 after the "=begin" command and a blank line before the "=end"
-command.
+command.)
 
 Here are some examples of how to use these:
 
@@ -270,28 +279,38 @@ normal formatting (e.g., may not be a normal-use paragraph, but might
 be for formatting as a footnote).
 
 =item C<=encoding I<encodingname>>
+X<=encoding> X<encoding>
 
 This command is used for declaring the encoding of a document.  Most
-users won't need this; but if your encoding isn't US-ASCII or Latin-1,
-then put a C<=encoding I<encodingname>> command early in the document so
+users won't need this; but if your encoding isn't US-ASCII,
+then put a C<=encoding I<encodingname>> command very early in the document so
 that pod formatters will know how to decode the document.  For
 I<encodingname>, use a name recognized by the L<Encode::Supported>
-module.  Examples:
+module.  Some pod formatters may try to guess between a Latin-1 or
+CP-1252 versus
+UTF-8 encoding, but they may guess wrong.  It's best to be explicit if
+you use anything besides strict ASCII.  Examples:
+
+  =encoding latin1
 
   =encoding utf8
 
   =encoding koi8-r
-  
+
   =encoding ShiftJIS
-  
+
   =encoding big5
 
+C<=encoding> affects the whole document, and must occur only once.
+
 =back
 
-And don't forget, when using any command, that the command lasts up
+And don't forget, all commands but C<=encoding> last up
 until the end of its I<paragraph>, not its line.  So in the
 examples below, you can see that every command needs the blank
-line after it, to end its paragraph.
+line after it, to end its paragraph.  (And some older Pod translators
+may require the C<=encoding> line to have a following blank line as
+well, even though it should be legal to omit.)
 
 Some examples of lists include:
 
@@ -321,6 +340,8 @@ Some examples of lists include:
 
 
 =head2 Formatting Codes
+X<POD, formatting code> X<formatting code>
+X<POD, interior sequence> X<interior sequence>
 
 In ordinary paragraphs and in some command paragraphs, various
 formatting codes (a.k.a. "interior sequences") can be used:
@@ -332,11 +353,13 @@ formatting codes (a.k.a. "interior sequences") can be used:
 =over
 
 =item C<IE<lt>textE<gt>> -- italic text
+X<I> X<< IZ<><> >> X<POD, formatting code, italic> X<italic>
 
 Used for emphasis ("C<be IE<lt>careful!E<gt>>") and parameters
 ("C<redo IE<lt>LABELE<gt>>")
 
 =item C<BE<lt>textE<gt>> -- bold text
+X<B> X<< BZ<><> >> X<POD, formatting code, bold> X<bold>
 
 Used for switches ("C<perl's BE<lt>-nE<gt> switch>"), programs
 ("C<some systems provide a BE<lt>chfnE<gt> for that>"),
@@ -344,12 +367,14 @@ emphasis ("C<be BE<lt>careful!E<gt>>"), and so on
 ("C<and that feature is known as BE<lt>autovivificationE<gt>>").
 
 =item C<CE<lt>codeE<gt>> -- code text
+X<C> X<< CZ<><> >> X<POD, formatting code, code> X<code>
 
 Renders code in a typewriter font, or gives some other indication that
 this represents program text ("C<CE<lt>gmtime($^T)E<gt>>") or some other
 form of computerese ("C<CE<lt>drwxr-xr-xE<gt>>").
 
 =item C<LE<lt>nameE<gt>> -- a hyperlink
+X<L> X<< LZ<><> >> X<POD, formatting code, hyperlink> X<hyperlink>
 
 There are various syntaxes, listed below.  In the syntaxes given,
 C<text>, C<name>, and C<section> cannot contain the characters
@@ -363,7 +388,7 @@ C<LE<lt>nameE<gt>>
 
 Link to a Perl manual page (e.g., C<LE<lt>Net::PingE<gt>>).  Note
 that C<name> should not contain spaces.  This syntax
-is also occasionally used for references to UNIX man pages, as in
+is also occasionally used for references to Unix man pages, as in
 C<LE<lt>crontab(5)E<gt>>.
 
 =item *
@@ -375,7 +400,7 @@ C<LE<lt>perlsyn/"For Loops"E<gt>>
 
 =item *
 
-C<LE<lt>/"sec"E<gt>> or C<LE<lt>/secE<gt>> or C<LE<lt>"sec"E<gt>>
+C<LE<lt>/"sec"E<gt>> or C<LE<lt>/secE<gt>>
 
 Link to a section in this manual page.  E.g.,
 C<LE<lt>/"Object Methods"E<gt>>
@@ -406,8 +431,7 @@ C<LE<lt>Perl Error Messages|perldiagE<gt>>
 C<LE<lt>text|name/"sec"E<gt>> or C<LE<lt>text|name/secE<gt>>
 
 Link this text to that section in that manual page.  E.g.,
-C<LE<lt>SWITCH statements|perlsyn/"Basic BLOCKs and Switch
-Statements"E<gt>>
+C<LE<lt>postfix "if"|perlsyn/"Statement Modifiers"E<gt>>
 
 =item *
 
@@ -427,14 +451,15 @@ Or you can link to a web page:
 
 C<LE<lt>scheme:...E<gt>>
 
-Links to an absolute URL.  For example,
-C<LE<lt>http://www.perl.org/E<gt>>.  But note
-that there is no corresponding C<LE<lt>text|scheme:...E<gt>> syntax, for
-various reasons.
+C<LE<lt>text|scheme:...E<gt>>
+
+Links to an absolute URL.  For example, C<LE<lt>http://www.perl.org/E<gt>> or
+C<LE<lt>The Perl Home Page|http://www.perl.org/E<gt>>.
 
 =back
 
 =item C<EE<lt>escapeE<gt>> -- a character escape
+X<E> X<< EZ<><> >> X<POD, formatting code, escape> X<escape>
 
 Very similar to HTML/XML C<&I<foo>;> "entity references":
 
@@ -454,7 +479,7 @@ C<EE<lt>verbarE<gt>> -- a literal | (I<ver>tical I<bar>)
 
 =item *
 
-C<EE<lt>solE<gt>> = a literal / (I<sol>idus)
+C<EE<lt>solE<gt>> -- a literal / (I<sol>idus)
 
 The above four are optional except in other formatting codes,
 notably C<LE<lt>...E<gt>>, and when preceded by a
@@ -481,34 +506,39 @@ in decimal, as in C<EE<lt>181E<gt>>.
 Note that older Pod formatters might not recognize octal or
 hex numeric escapes, and that many formatters cannot reliably
 render characters above 255.  (Some formatters may even have
-to use compromised renderings of Latin-1 characters, like
+to use compromised renderings of Latin-1/CP-1252 characters, like
 rendering C<EE<lt>eacuteE<gt>> as just a plain "e".)
 
 =back
 
 =item C<FE<lt>filenameE<gt>> -- used for filenames
+X<F> X<< FZ<><> >> X<POD, formatting code, filename> X<filename>
 
 Typically displayed in italics.  Example: "C<FE<lt>.cshrcE<gt>>"
 
 =item C<SE<lt>textE<gt>> -- text contains non-breaking spaces
+X<S> X<< SZ<><> >> X<POD, formatting code, non-breaking space> 
+X<non-breaking space>
 
 This means that the words in I<text> should not be broken
 across lines.  Example: S<C<SE<lt>$x ? $y : $zE<gt>>>.
 
 =item C<XE<lt>topic nameE<gt>> -- an index entry
+X<X> X<< XZ<><> >> X<POD, formatting code, index entry> X<index entry>
 
 This is ignored by most formatters, but some may use it for building
 indexes.  It always renders as empty-string.
 Example: C<XE<lt>absolutizing relative URLsE<gt>>
 
 =item C<ZE<lt>E<gt>> -- a null (zero-effect) formatting code
+X<Z> X<< ZZ<><> >> X<POD, formatting code, null> X<null>
 
 This is rarely used.  It's one way to get around using an
 EE<lt>...E<gt> code sometimes.  For example, instead of
 "C<NEE<lt>ltE<gt>3>" (for "NE<lt>3") you could write
 "C<NZE<lt>E<gt>E<lt>3>" (the "ZE<lt>E<gt>" breaks up the "N" and
 the "E<lt>" so they can't be considered
-the part of a (fictitious) "NE<lt>...E<gt>" code.
+the part of a (fictitious) "NE<lt>...E<gt>" code).
 
 =for comment
  This was formerly explained as a "zero-width character".  But it in
@@ -532,12 +562,12 @@ using an C<E> code:
 This will produce: "C<$a E<lt>=E<gt> $b>"
 
 A more readable, and perhaps more "plain" way is to use an alternate
-set of delimiters that doesn't require a single ">" to be escaped.  With
-the Pod formatters that are standard starting with perl5.5.660, doubled
-angle brackets ("<<" and ">>") may be used I<if and only if there is
+set of delimiters that doesn't require a single ">" to be escaped.
+Doubled angle brackets ("<<" and ">>") may be used I<if and only if there is
 whitespace right after the opening delimiter and whitespace right
 before the closing delimiter!>  For example, the following will
 do the trick:
+X<POD, formatting code, escaping with multiple brackets>
 
     C<< $a <=> $b >>
 
@@ -547,6 +577,7 @@ delimiters, and make sure that whitespace immediately follows the last
 '<' of the opening delimiter, and immediately precedes the first '>'
 of the closing delimiter.  (The whitespace is ignored.)  So the
 following will also work:
+X<POD, formatting code, escaping with multiple brackets>
 
     C<<< $a <=> $b >>>
     C<<<<  $a <=> $b     >>>>
@@ -555,6 +586,12 @@ And they all mean exactly the same as this:
 
     C<$a E<lt>=E<gt> $b>
 
+The multiple-bracket form does not affect the interpretation of the contents of
+the formatting code, only how it must end.  That means that the examples above
+are also exactly the same as this:
+
+    C<< $a E<lt>=E<gt> $b >>
+
 As a further example, this means that if you wanted to put these bits of
 code in C<C> (code) style:
 
@@ -576,6 +613,7 @@ and any other pod2xxx or Pod::Xxxx translators that use
 Pod::Parser 1.093 or later, or Pod::Tree 1.02 or later.
 
 =head2 The Intent
+X<POD, intent of>
 
 The intent is simplicity of use, not power of expression.  Paragraphs
 look like paragraphs (block format), so that they stand out
@@ -595,14 +633,19 @@ B<pod2fm>.  Various others are available in CPAN.
 
 
 =head2 Embedding Pods in Perl Modules
+X<POD, embedding>
+
+You can embed Pod documentation in your Perl modules and scripts.  Start
+your documentation with an empty line, a "=head1" command at the
+beginning, and end it with a "=cut" command and an empty line.  The
+B<perl> executable will ignore the Pod text.  You can place a Pod
+statement where B<perl> expects the beginning of a new statement, but
+not within a statement, as that would result in an error.  See any of
+the supplied library modules for examples.
 
-You can embed Pod documentation in your Perl modules and scripts.
-Start your documentation with an empty line, a "=head1" command at the
-beginning, and end it with a "=cut" command and an empty line.  Perl
-will ignore the Pod text.  See any of the supplied library modules for
-examples.  If you're going to put your Pod at the end of the file, and
-you're using an __END__ or __DATA__ cut mark, make sure to put an
-empty line there before the first Pod command.
+If you're going to put your Pod at the end of the file, and you're using
+an C<__END__> or C<__DATA__> cut mark, make sure to put an empty line there
+before the first Pod command.
 
   __END__
 
@@ -618,6 +661,7 @@ have recognized the "=head1" as starting a Pod block.
 =over
 
 =item *
+X<podchecker> X<POD, validating>
 
 The B<podchecker> command is provided for checking Pod syntax for errors
 and warnings.  For example, it checks for completely blank lines in
@@ -678,8 +722,8 @@ that could cause odd formatting.
 Older translators might add wording around an LE<lt>E<gt> link, so that
 C<LE<lt>Foo::BarE<gt>> may become "the Foo::Bar manpage", for example.
 So you shouldn't write things like C<the LE<lt>fooE<gt>
-documentation>, if you want the translated document to read sensibly
--- instead write C<the LE<lt>Foo::Bar|Foo::BarE<gt> documentation> or
+documentation>, if you want the translated document to read sensibly.
+Instead, write C<the LE<lt>Foo::Bar|Foo::BarE<gt> documentation> or
 C<LE<lt>the Foo::Bar documentation|Foo::BarE<gt>>, to control how the
 link comes out.