perlmodlib.html

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

HTML
2,448
字号
<?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>perlmodlib - constructing new Perl modules and finding existing ones</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>perlmodlib - constructing new Perl modules and finding existing ones</a></h1>
<p><a name="__index__"></a></p>

<!-- INDEX BEGIN -->

<ul>

	<li><a href="#name">NAME</a></li>
	<li><a href="#the_perl_module_library">THE PERL MODULE LIBRARY</a></li>
	<ul>

		<li><a href="#pragmatic_modules">Pragmatic Modules</a></li>
		<li><a href="#standard_modules">Standard Modules</a></li>
		<li><a href="#extension_modules">Extension Modules</a></li>
	</ul>

	<li><a href="#cpan">CPAN</a></li>
	<ul>

		<li><a href="#africa">Africa</a></li>
		<li><a href="#asia">Asia</a></li>
		<li><a href="#central_america">Central America</a></li>
		<li><a href="#europe">Europe</a></li>
		<li><a href="#north_america">North America</a></li>
		<li><a href="#oceania">Oceania</a></li>
		<li><a href="#south_america">South America</a></li>
		<li><a href="#rsync_mirrors">RSYNC Mirrors</a></li>
	</ul>

	<li><a href="#modules__creation__use__and_abuse">Modules: Creation, Use, and Abuse</a></li>
	<ul>

		<li><a href="#guidelines_for_module_creation">Guidelines for Module Creation</a></li>
		<li><a href="#guidelines_for_converting_perl_4_library_scripts_into_modules">Guidelines for Converting Perl 4 Library Scripts into Modules</a></li>
		<li><a href="#guidelines_for_reusing_application_code">Guidelines for Reusing Application Code</a></li>
	</ul>

	<li><a href="#note">NOTE</a></li>
</ul>
<!-- INDEX END -->

<hr />
<p>
</p>
<hr />
<h1><a name="name">NAME</a></h1>
<p>perlmodlib - constructing new Perl modules and finding existing ones</p>
<p>
</p>
<hr />
<h1><a name="the_perl_module_library">THE PERL MODULE LIBRARY</a></h1>
<p>Many modules are included in the Perl distribution.  These are described
below, and all end in <em>.pm</em>.  You may discover compiled library
files (usually ending in <em>.so</em>) or small pieces of modules to be
autoloaded (ending in <em>.al</em>); these were automatically generated
by the installation process.  You may also discover files in the
library directory that end in either <em>.pl</em> or <em>.ph</em>.  These are
old libraries supplied so that old programs that use them still
run.  The <em>.pl</em> files will all eventually be converted into standard
modules, and the <em>.ph</em> files made by <strong>h2ph</strong> will probably end up
as extension modules made by <strong>h2xs</strong>.  (Some <em>.ph</em> values may
already be available through the POSIX, Errno, or Fcntl modules.)
The <strong>pl2pm</strong> file in the distribution may help in your conversion,
but it's just a mechanical process and therefore far from bulletproof.</p>
<p>
</p>
<h2><a name="pragmatic_modules">Pragmatic Modules</a></h2>
<p>They work somewhat like compiler directives (pragmata) in that they
tend to affect the compilation of your program, and thus will usually
work well only when used within a <a href="../../lib/Pod/perlfunc.html#item_use"><code>use</code></a>, or <a href="../../lib/Pod/perlfunc.html#item_no"><code>no</code></a>.  Most of these
are lexically scoped, so an inner BLOCK may countermand them
by saying:</p>
<pre>
    <span class="keyword">no</span> <span class="variable">integer</span><span class="operator">;</span>
    <span class="keyword">no</span> <span class="variable">strict</span> <span class="string">'refs'</span><span class="operator">;</span>
    <span class="keyword">no</span> <span class="variable">warnings</span><span class="operator">;</span>
</pre>
<p>which lasts until the end of that BLOCK.</p>
<p>Some pragmas are lexically scoped--typically those that affect the
<a href="../../lib/Pod/perlvar.html#item___h"><code>$^H</code></a> hints variable.  Others affect the current package instead,
like <code>use vars</code> and <code>use subs</code>, which allow you to predeclare a
variables or subroutines within a particular <em>file</em> rather than
just a block.  Such declarations are effective for the entire file
for which they were declared.  You cannot rescind them with <code>no
vars</code> or <code>no subs</code>.</p>
<p>The following pragmas are defined (and have their own documentation).</p>
<dl>
<dt><strong><a name="item_attributes">attributes</a></strong>

<dd>
<p>Get/set subroutine or variable attributes</p>
</dd>
</li>
<dt><strong><a name="item_attrs">attrs</a></strong>

<dd>
<p>Set/get attributes of a subroutine (deprecated)</p>
</dd>
</li>
<dt><strong><a name="item_autouse">autouse</a></strong>

<dd>
<p>Postpone load of modules until a function is used</p>
</dd>
</li>
<dt><strong><a name="item_base">base</a></strong>

<dd>
<p>Establish IS-A relationship with base classes at compile time</p>
</dd>
</li>
<dt><strong><a name="item_bigint">bigint</a></strong>

<dd>
<p>Transparent BigInteger support for Perl</p>
</dd>
</li>
<dt><strong><a name="item_bignum">bignum</a></strong>

<dd>
<p>Transparent BigNumber support for Perl</p>
</dd>
</li>
<dt><strong><a name="item_bigrat">bigrat</a></strong>

<dd>
<p>Transparent BigNumber/BigRational support for Perl</p>
</dd>
</li>
<dt><strong><a name="item_blib">blib</a></strong>

<dd>
<p>Use MakeMaker's uninstalled version of a package</p>
</dd>
</li>
<dt><strong><a name="item_bytes">bytes</a></strong>

<dd>
<p>Force byte semantics rather than character semantics</p>
</dd>
</li>
<dt><strong><a name="item_charnames">charnames</a></strong>

<dd>
<p>Define character names for <code>\N{named}</code> string literal escapes</p>
</dd>
</li>
<dt><strong><a name="item_constant">constant</a></strong>

<dd>
<p>Declare constants</p>
</dd>
</li>
<dt><strong><a name="item_diagnostics">diagnostics</a></strong>

<dd>
<p>Produce verbose warning diagnostics</p>
</dd>
</li>
<dt><strong><a name="item_encoding">encoding</a></strong>

<dd>
<p>Allows you to write your script in non-ascii or non-utf8</p>
</dd>
</li>
<dt><strong><a name="item_fields">fields</a></strong>

<dd>
<p>Compile-time class fields</p>
</dd>
</li>
<dt><strong><a name="item_filetest">filetest</a></strong>

<dd>
<p>Control the filetest permission operators</p>
</dd>
</li>
<dt><strong><a name="item_if">if</a></strong>

<dd>
<p><a href="../../lib/Pod/perlfunc.html#item_use"><code>use</code></a> a Perl module if a condition holds</p>
</dd>
</li>
<dt><strong><a name="item_integer">integer</a></strong>

<dd>
<p>Use integer arithmetic instead of floating point</p>
</dd>
</li>
<dt><strong><a name="item_less">less</a></strong>

<dd>
<p>Request less of something from the compiler</p>
</dd>
</li>
<dt><strong><a name="item_lib">lib</a></strong>

<dd>
<p>Manipulate @INC at compile time</p>
</dd>
</li>
<dt><strong><a name="item_locale">locale</a></strong>

<dd>
<p>Use and avoid POSIX locales for built-in operations</p>
</dd>
</li>
<dt><strong><a name="item_open">open</a></strong>

<dd>
<p>Set default PerlIO layers for input and output</p>
</dd>
</li>
<dt><strong><a name="item_ops">ops</a></strong>

<dd>
<p>Restrict unsafe operations when compiling</p>
</dd>
</li>
<dt><strong><a name="item_overload">overload</a></strong>

<dd>
<p>Package for overloading Perl operations</p>
</dd>
</li>
<dt><strong><a name="item_re">re</a></strong>

<dd>
<p>Alter regular expression behaviour</p>
</dd>
</li>
<dt><strong><a name="item_sigtrap">sigtrap</a></strong>

<dd>
<p>Enable simple signal handling</p>
</dd>
</li>
<dt><strong><a name="item_sort">sort</a></strong>

<dd>
<p>Control <a href="#item_sort"><code>sort()</code></a> behaviour</p>
</dd>
</li>
<dt><strong><a name="item_strict">strict</a></strong>

<dd>
<p>Restrict unsafe constructs</p>
</dd>
</li>
<dt><strong><a name="item_subs">subs</a></strong>

<dd>
<p>Predeclare sub names</p>
</dd>
</li>
<dt><strong><a name="item_threads">threads</a></strong>

<dd>
<p>Perl extension allowing use of interpreter based threads from perl</p>
</dd>
</li>
<dt><strong><a name="item_threads_3a_3ashared">threads::shared</a></strong>

<dd>
<p>Perl extension for sharing data structures between threads</p>
</dd>
</li>
<dt><strong><a name="item_utf8">utf8</a></strong>

<dd>
<p>Enable/disable UTF-8 (or UTF-EBCDIC) in source code</p>
</dd>
</li>
<dt><strong><a name="item_vars">vars</a></strong>

<dd>
<p>Predeclare global variable names (obsolete)</p>
</dd>
</li>
<dt><strong><a name="item_vmsish">vmsish</a></strong>

<dd>
<p>Control VMS-specific language features</p>
</dd>
</li>
<dt><strong><a name="item_warnings">warnings</a></strong>

<dd>
<p>Control optional warnings</p>
</dd>
</li>
<dt><strong><a name="item_warnings_3a_3aregister">warnings::register</a></strong>

<dd>
<p>Warnings import function</p>
</dd>
</li>
</dl>
<p>
</p>
<h2><a name="standard_modules">Standard Modules</a></h2>
<p>Standard, bundled modules are all expected to behave in a well-defined
manner with respect to namespace pollution because they use the
Exporter module.  See their own documentation for details.</p>
<p>It's possible that not all modules listed below are installed on your
system. For example, the GDBM_File module will not be installed if you
don't have the gdbm library.</p>
<dl>
<dt><strong><a name="item_anydbm_file">AnyDBM_File</a></strong>

<dd>
<p>Provide framework for multiple DBMs</p>
</dd>
</li>
<dt><strong><a name="item_attribute_3a_3ahandlers">Attribute::Handlers</a></strong>

<dd>
<p>Simpler definition of attribute handlers</p>
</dd>
</li>
<dt><strong><a name="item_autoloader">AutoLoader</a></strong>

<dd>
<p>Load subroutines only on demand</p>
</dd>
</li>
<dt><strong><a name="item_autosplit">AutoSplit</a></strong>

<dd>
<p>Split a package for autoloading</p>
</dd>
</li>
<dt><strong><a name="item_b">B</a></strong>

<dd>
<p>The Perl Compiler</p>
</dd>
</li>
<dt><strong><a name="item_b_3a_3aasmdata">B::Asmdata</a></strong>

<dd>
<p>Autogenerated data about Perl ops, used to generate bytecode</p>
</dd>
</li>
<dt><strong><a name="item_b_3a_3aassembler">B::Assembler</a></strong>

<dd>
<p>Assemble Perl bytecode</p>
</dd>
</li>
<dt><strong><a name="item_b_3a_3abblock">B::Bblock</a></strong>

<dd>
<p>Walk basic blocks</p>
</dd>
</li>
<dt><strong><a name="item_b_3a_3abytecode">B::Bytecode</a></strong>

<dd>
<p>Perl compiler's bytecode backend</p>
</dd>
</li>
<dt><strong><a name="item_b_3a_3ac">B::C</a></strong>

<dd>
<p>Perl compiler's C backend</p>
</dd>
</li>
<dt><strong><a name="item_b_3a_3acc">B::CC</a></strong>

<dd>
<p>Perl compiler's optimized C translation backend</p>
</dd>
</li>
<dt><strong><a name="item_b_3a_3aconcise">B::Concise</a></strong>

<dd>
<p>Walk Perl syntax tree, printing concise info about ops</p>
</dd>
</li>
<dt><strong><a name="item_b_3a_3adebug">B::Debug</a></strong>

<dd>
<p>Walk Perl syntax tree, printing debug info about ops</p>
</dd>
</li>
<dt><strong><a name="item_b_3a_3adeparse">B::Deparse</a></strong>

<dd>
<p>Perl compiler backend to produce perl code</p>
</dd>
</li>
<dt><strong><a name="item_b_3a_3adisassembler">B::Disassembler</a></strong>

<dd>
<p>Disassemble Perl bytecode</p>
</dd>
</li>
<dt><strong><a name="item_b_3a_3alint">B::Lint</a></strong>

<dd>
<p>Perl lint</p>
</dd>
</li>
<dt><strong><a name="item_b_3a_3ashowlex">B::Showlex</a></strong>

<dd>
<p>Show lexical variables used in functions or files</p>
</dd>
</li>
<dt><strong><a name="item_b_3a_3astackobj">B::Stackobj</a></strong>

<dd>
<p>Helper module for CC backend</p>
</dd>
</li>
<dt><strong><a name="item_b_3a_3astash">B::Stash</a></strong>

<dd>
<p>Show what stashes are loaded</p>
</dd>
</li>
<dt><strong><a name="item_b_3a_3aterse">B::Terse</a></strong>

<dd>
<p>Walk Perl syntax tree, printing terse info about ops</p>
</dd>
</li>
<dt><strong><a name="item_b_3a_3axref">B::Xref</a></strong>

<dd>
<p>Generates cross reference reports for Perl programs</p>
</dd>
</li>
<dt><strong><a name="item_benchmark">Benchmark</a></strong>

<dd>
<p>Benchmark running times of Perl code</p>
</dd>
</li>
<dt><strong><a name="item_byteloader">ByteLoader</a></strong>

<dd>
<p>Load byte compiled perl code</p>
</dd>
</li>
<dt><strong><a name="item_cgi">CGI</a></strong>

<dd>
<p>Simple Common Gateway Interface Class</p>
</dd>
</li>
<dt><strong><a name="item_cgi_3a_3aapache">CGI::Apache</a></strong>

<dd>
<p>Backward compatibility module for CGI.pm</p>
</dd>
</li>
<dt><strong><a name="item_cgi_3a_3acarp">CGI::Carp</a></strong>

<dd>
<p>CGI routines for writing to the HTTPD (or other) error log</p>
</dd>
</li>
<dt><strong><a name="item_cgi_3a_3acookie">CGI::Cookie</a></strong>

<dd>
<p>Interface to Netscape Cookies</p>
</dd>
</li>
<dt><strong><a name="item_cgi_3a_3afast">CGI::Fast</a></strong>

⌨️ 快捷键说明

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