man.html

来自「perl教程」· HTML 代码 · 共 336 行 · 第 1/2 页

HTML
336
字号
<?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>Pod::Man - Convert POD data to formatted *roff input</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>Pod::Man - Convert POD data to formatted *roff input</a></h1>
<p><a name="__index__"></a></p>

<!-- INDEX BEGIN -->

<ul>

	<li><a href="#name">NAME</a></li>
	<li><a href="#synopsis">SYNOPSIS</a></li>
	<li><a href="#description">DESCRIPTION</a></li>
	<li><a href="#diagnostics">DIAGNOSTICS</a></li>
	<li><a href="#bugs">BUGS</a></li>
	<li><a href="#caveats">CAVEATS</a></li>
	<li><a href="#see_also">SEE ALSO</a></li>
	<li><a href="#author">AUTHOR</a></li>
	<li><a href="#copyright_and_license">COPYRIGHT AND LICENSE</a></li>
</ul>
<!-- INDEX END -->

<hr />
<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>Pod::Man - Convert POD data to formatted *roff input</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
    <span class="keyword">use</span> <span class="variable">Pod::Man</span><span class="operator">;</span>
    <span class="keyword">my</span> <span class="variable">$parser</span> <span class="operator">=</span> <span class="variable">Pod::Man</span><span class="operator">-&gt;</span><span class="variable">new</span> <span class="operator">(</span><span class="string">release</span> <span class="operator">=&gt;</span> <span class="variable">$VERSION</span><span class="operator">,</span> <span class="string">section</span> <span class="operator">=&gt;</span> <span class="number">8</span><span class="operator">);</span>
</pre>
<pre>
    <span class="comment"># Read POD from STDIN and write to STDOUT.</span>
    <span class="variable">$parser</span><span class="operator">-&gt;</span><span class="variable">parse_from_filehandle</span><span class="operator">;</span>
</pre>
<pre>
    <span class="comment"># Read POD from file.pod and write to file.1.</span>
    <span class="variable">$parser</span><span class="operator">-&gt;</span><span class="variable">parse_from_file</span> <span class="operator">(</span><span class="string">'file.pod'</span><span class="operator">,</span> <span class="string">'file.1'</span><span class="operator">);</span>
</pre>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>Pod::Man is a module to convert documentation in the POD format (the
preferred language for documenting Perl) into *roff input using the man
macro set.  The resulting *roff code is suitable for display on a terminal
using <em>nroff(1)</em>, normally via <em>man(1)</em>, or printing using <em>troff(1)</em>.
It is conventionally invoked using the driver script <strong>pod2man</strong>, but it can
also be used directly.</p>
<p>As a derived class from Pod::Parser, Pod::Man supports the same methods and
interfaces.  See <a href="../../lib/Pod/Parser.html">the Pod::Parser manpage</a> for all the details; briefly, one creates a
new parser with <code>Pod::Man-&gt;new()</code> and then calls either
<code>parse_from_filehandle()</code> or parse_from_file().</p>
<p><code>new()</code> can take options, in the form of key/value pairs that control the
behavior of the parser.  See below for details.</p>
<p>If no options are given, Pod::Man uses the name of the input file with any
trailing <code>.pod</code>, <code>.pm</code>, or <code>.pl</code> stripped as the man page title, to
section 1 unless the file ended in <code>.pm</code> in which case it defaults to
section 3, to a centered title of &quot;User Contributed Perl Documentation&quot;, to
a centered footer of the Perl version it is run with, and to a left-hand
footer of the modification date of its input (or the current date if given
STDIN for input).</p>
<p>Pod::Man assumes that your *roff formatters have a fixed-width font named
CW.  If yours is called something else (like CR), use the <a href="#item_fixed"><code>fixed</code></a> option to
specify it.  This generally only matters for troff output for printing.
Similarly, you can set the fonts used for bold, italic, and bold italic
fixed-width output.</p>
<p>Besides the obvious pod conversions, Pod::Man also takes care of formatting
func(), func(3), and simple variable references like $foo or @bar so you
don't have to use code escapes for them; complex expressions like
<code>$fred{'stuff'}</code> will still need to be escaped, though.  It also translates
dashes that aren't used as hyphens into en dashes, makes long dashes--like
this--into proper em dashes, fixes &quot;paired quotes,&quot; makes C++ look right,
puts a little space between double underbars, makes ALLCAPS a teeny bit
smaller in <strong>troff</strong>, and escapes stuff that *roff treats as special so that
you don't have to.</p>
<p>The recognized options to <code>new()</code> are as follows.  All options take a single
argument.</p>
<dl>
<dt><strong><a name="item_center">center</a></strong>

<dd>
<p>Sets the centered page header to use instead of &quot;User Contributed Perl
Documentation&quot;.</p>
</dd>
</li>
<dt><strong><a name="item_date">date</a></strong>

<dd>
<p>Sets the left-hand footer.  By default, the modification date of the input
file will be used, or the current date if <a href="../../lib/Pod/perlfunc.html#item_stat"><code>stat()</code></a> can't find that file (the
case if the input is from STDIN), and the date will be formatted as
YYYY-MM-DD.</p>
</dd>
</li>
<dt><strong><a name="item_fixed">fixed</a></strong>

<dd>
<p>The fixed-width font to use for vertabim text and code.  Defaults to CW.
Some systems may want CR instead.  Only matters for <strong>troff</strong> output.</p>
</dd>
</li>
<dt><strong><a name="item_fixedbold">fixedbold</a></strong>

<dd>
<p>Bold version of the fixed-width font.  Defaults to CB.  Only matters for
<strong>troff</strong> output.</p>
</dd>
</li>
<dt><strong><a name="item_fixeditalic">fixeditalic</a></strong>

<dd>
<p>Italic version of the fixed-width font (actually, something of a misnomer,
since most fixed-width fonts only have an oblique version, not an italic
version).  Defaults to CI.  Only matters for <strong>troff</strong> output.</p>
</dd>
</li>
<dt><strong><a name="item_fixedbolditalic">fixedbolditalic</a></strong>

<dd>
<p>Bold italic (probably actually oblique) version of the fixed-width font.
Pod::Man doesn't assume you have this, and defaults to CB.  Some systems
(such as Solaris) have this font available as CX.  Only matters for <strong>troff</strong>
output.</p>
</dd>
</li>
<dt><strong><a name="item_name">name</a></strong>

<dd>
<p>Set the name of the manual page.  Without this option, the manual name is
set to the uppercased base name of the file being converted unless the
manual section is 3, in which case the path is parsed to see if it is a Perl
module path.  If it is, a path like <code>.../lib/Pod/Man.pm</code> is converted into
a name like <code>Pod::Man</code>.  This option, if given, overrides any automatic
determination of the name.</p>
</dd>
</li>
<dt><strong><a name="item_quotes">quotes</a></strong>

<dd>
<p>Sets the quote marks used to surround C&lt;&gt; text.  If the value is a
single character, it is used as both the left and right quote; if it is two
characters, the first character is used as the left quote and the second as
the right quoted; and if it is four characters, the first two are used as
the left quote and the second two as the right quote.</p>
</dd>
<dd>
<p>This may also be set to the special value <code>none</code>, in which case no quote
marks are added around C&lt;&gt; text (but the font is still changed for troff

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?