perlpod.html
来自「perl教程」· HTML 代码 · 共 769 行 · 第 1/3 页
HTML
769 行
<?xml version="1.0" ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<!-- saved from url=(0017)http://localhost/ -->
<script language="JavaScript" src="../../displayToc.js"></script>
<script language="JavaScript" src="../../tocParas.js"></script>
<script language="JavaScript" src="../../tocTab.js"></script>
<link rel="stylesheet" type="text/css" href="../../scineplex.css">
<title>perlpod - the Plain Old Documentation format</title>
<link rel="stylesheet" href="../../Active.css" type="text/css" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:" />
</head>
<body>
<script>writelinks('__top__',2);</script>
<h1><a>perlpod - the Plain Old Documentation format</a></h1>
<p><a name="__index__"></a></p>
<!-- INDEX BEGIN -->
<ul>
<li><a href="#name">NAME</a></li>
<li><a href="#description">DESCRIPTION</a></li>
<ul>
<li><a href="#ordinary_paragraph">Ordinary Paragraph</a></li>
<li><a href="#verbatim_paragraph">Verbatim Paragraph</a></li>
<li><a href="#command_paragraph">Command Paragraph</a></li>
<li><a href="#formatting_codes">Formatting Codes</a></li>
<li><a href="#the_intent">The Intent</a></li>
<li><a href="#embedding_pods_in_perl_modules">Embedding Pods in Perl Modules</a></li>
<li><a href="#hints_for_writing_pod">Hints for Writing Pod</a></li>
</ul>
<li><a href="#see_also">SEE ALSO</a></li>
<li><a href="#author">AUTHOR</a></li>
</ul>
<!-- INDEX END -->
<hr />
<p>
</p>
<hr />
<h1><a name="name">NAME</a></h1>
<p>perlpod - the Plain Old Documentation format</p>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>Pod is a simple-to-use markup language used for writing documentation
for Perl, Perl programs, and Perl modules.</p>
<p>Translators are available for converting Pod to various formats
like plain text, HTML, man pages, and more.</p>
<p>Pod markup consists of three basic kinds of paragraphs:
<a href="#ordinary_paragraph">ordinary</a>,
<a href="#verbatim_paragraph">verbatim</a>, and
<a href="#command_paragraph">command</a>.</p>
<p>
</p>
<h2><a name="ordinary_paragraph">Ordinary Paragraph</a></h2>
<p>Most paragraphs in your documentation will be ordinary blocks
of text, like this one. You can simply type in your text without
any markup whatsoever, and with just a blank line before and
after. When it gets formatted, it will undergo minimal formatting,
like being rewrapped, probably put into a proportionally spaced
font, and maybe even justified.</p>
<p>You can use formatting codes in ordinary paragraphs, for <strong>bold</strong>,
<em>italic</em>, <code>code-style</code>, <a href="../../lib/Pod/perlfaq.html">hyperlinks</a>, and more. Such
codes are explained in the "<a href="#formatting_codes">Formatting Codes</a>"
section, below.</p>
<p>
</p>
<h2><a name="verbatim_paragraph">Verbatim Paragraph</a></h2>
<p>Verbatim paragraphs are usually used for presenting a codeblock or
other text which does not require any special parsing or formatting,
and which shouldn't be wrapped.</p>
<p>A verbatim paragraph is distinguished by having its first character
be a space or a tab. (And commonly, all its lines begin with spaces
and/or tabs.) It should be reproduced exactly, with tabs assumed to
be on 8-column boundaries. There are no special formatting codes,
so you can't italicize or anything like that. A \ means \, and
nothing else.</p>
<p>
</p>
<h2><a name="command_paragraph">Command Paragraph</a></h2>
<p>A command paragraph is used for special treatment of whole chunks
of text, usually as headings or parts of lists.</p>
<p>All command paragraphs (which are typically only one line long) start
with "=", followed by an identifier, followed by arbitrary text that
the command can use however it pleases. Currently recognized commands
are</p>
<pre>
=pod
=head1 Heading Text
=head2 Heading Text
=head3 Heading Text
=head4 Heading Text
=over indentlevel
=item stuff
=back
=begin format
=end format
=for format text...
=encoding type
=cut</pre>
<p>To explain them each in detail:</p>
<dl>
<dt><strong><a name="item__3dhead1_heading_text"><code>=head1 Heading Text</code></a></strong>
<dt><strong><a name="item__3dhead2_heading_text"><code>=head2 Heading Text</code></a></strong>
<dt><strong><a name="item__3dhead3_heading_text"><code>=head3 Heading Text</code></a></strong>
<dt><strong><a name="item__3dhead4_heading_text"><code>=head4 Heading Text</code></a></strong>
<dd>
<p>Head1 through head4 produce headings, head1 being the highest
level. The text in the rest of this paragraph is the content of the
heading. For example:</p>
</dd>
<dd>
<pre>
=head2 Object Attributes</pre>
</dd>
<dd>
<p>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:</p>
</dd>
<dd>
<pre>
=head2 Possible Values for C<$/></pre>
</dd>
<dd>
<p>Such commands are explained in the
"<a href="#formatting_codes">Formatting Codes</a>" section, below.</p>
</dd>
</li>
<dt><strong><a name="item__3dover_indentlevel"><code>=over indentlevel</code></a></strong>
<dt><strong><a name="item__3ditem_stuff_2e_2e_2e"><code>=item stuff...</code></a></strong>
<dt><strong><a name="item__3dback"><code>=back</code></a></strong>
<dd>
<p>Item, over, and back require a little more explanation: "=over" starts
a region specifically for the generation of a list using "=item"
commands, or for indenting (groups of) normal paragraphs. At the end
of your list, use "=back" to end it. The <em>indentlevel</em> option to
"=over" indicates how far over to indent, generally in ems (where
one em is the width of an "M" in the document's base font) or roughly
comparable units; if there is no <em>indentlevel</em> option, it defaults
to four. (And some formatters may just ignore whatever <em>indentlevel</em>
you provide.) In the <em>stuff</em> in <a href="#item__3ditem_stuff_2e_2e_2e"><code>=item stuff...</code></a>, you may
use formatting codes, as seen here:</p>
</dd>
<dd>
<pre>
=item Using C<$|> to Control Buffering</pre>
</dd>
<dd>
<p>Such commands are explained in the
"<a href="#formatting_codes">Formatting Codes</a>" section, below.</p>
</dd>
<dd>
<p>Note also that there are some basic rules to using "=over" ...
"=back" regions:</p>
</dd>
<ul>
<li>
<p>Don't use "=item"s outside of an "=over" ... "=back" region.</p>
</li>
<li>
<p>The first thing after the "=over" command should be an "=item", unless
there aren't going to be any items at all in this "=over" ... "=back"
region.</p>
</li>
<li>
<p>Don't put "=head<em>n</em>" commands inside an "=over" ... "=back" region.</p>
</li>
<li>
<p>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
numbers.</p>
<p>If you start with bullets or numbers, stick with them, as
formatters use the first "=item" type to decide how to format the
list.</p>
</li>
</ul>
<dt><strong><a name="item__3dcut"><code>=cut</code></a></strong>
<dd>
<p>To end a Pod block, use a blank line,
then a line beginning with "=cut", and a blank
line after it. This lets Perl (and the Pod formatter) know that
this is where Perl code is resuming. (The blank line before the "=cut"
is not technically necessary, but many older Pod processors require it.)</p>
</dd>
</li>
<dt><strong><a name="item__3dpod"><code>=pod</code></a></strong>
<dd>
<p>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
Pod block starts with <em>any</em> command paragraph, so a "=pod" command is
usually used just when you want to start a Pod block with an ordinary
paragraph or a verbatim paragraph. For example:</p>
</dd>
<dd>
<pre>
=item stuff()</pre>
</dd>
<dd>
<pre>
This function does stuff.</pre>
</dd>
<dd>
<pre>
=cut</pre>
</dd>
<dd>
<pre>
<span class="keyword">sub</span><span class="variable"> stuff </span><span class="operator">{</span>
<span class="operator">...</span>
<span class="operator">}</span>
</pre>
</dd>
<dd>
<pre>
=pod</pre>
</dd>
<dd>
<pre>
Remember to check its return value, as in:</pre>
</dd>
<dd>
<pre>
<span class="variable">stuff</span><span class="operator">()</span> <span class="operator">||</span> <span class="keyword">die</span> <span class="string">"Couldn't do stuff!"</span><span class="operator">;</span>
</pre>
</dd>
<dd>
<pre>
=cut</pre>
</dd>
</li>
<dt><strong><a name="item__3dbegin_formatname"><code>=begin formatname</code></a></strong>
<dt><strong><a name="item__3dend_formatname"><code>=end formatname</code></a></strong>
<dt><strong><a name="item__3dfor_formatname_text_2e_2e_2e"><code>=for formatname text...</code></a></strong>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?