⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 appb_01.htm

📁 用perl编写CGI的好书。本书从解释CGI和底层HTTP协议如何工作开始
💻 HTM
字号:
<?label B. Perl Modules?><html><head><title>Perl Modules (CGI Programming with Perl)</title><link href="../style/style1.css" type="text/css" rel="stylesheet" /><meta name="DC.Creator" content="Scott Guelich, Gunther Birznieks and Shishir Gundavaram" /><meta scheme="MIME" content="text/xml" name="DC.Format" /><meta content="en-US" name="DC.Language" /><meta content="O'Reilly & Associates, Inc." name="DC.Publisher" /><meta scheme="ISBN" name="DC.Source" content="1565924193L" /><meta name="DC.Subject.Keyword" content="stuff" /><meta name="DC.Title" content="CGI Programming with Perl" /><meta content="Text.Monograph" name="DC.Type" /></head><body bgcolor="#ffffff"><img src="gifs/smbanner.gif" alt="Book Home" usemap="#banner-map" border="0" /><map name="banner-map"><area alt="CGI Programming with Perl" href="index.htm" coords="0,0,466,65" shape="rect" /><area alt="Search this book" href="jobjects/fsearch.htm" coords="467,0,514,18" shape="rect" /></map><div class="navbar"><table border="0" width="515"><tr><td width="172" valign="top" align="left"><a href="appa_06.htm"><img src="../gifs/txtpreva.gif" alt="Previous" border="0" /></a></td><td width="171" valign="top" align="center"><a href="index.htm">CGI Programming with Perl</a></td><td width="172" valign="top" align="right"><a href="appb_02.htm"><img src="../gifs/txtnexta.gif" alt="Next" border="0" /></a></td></tr></table></div><hr align="left" width="515" /><h1 class="chapter">Appendix B. Perl Modules</h1><div class="htmltoc"><h4 class="tochead">Contents:</h4><p><a href="appb_01.htm">CPAN</a><br><a href="appb_02.htm">perldoc</a><br></p></div><p>This book discusses many <a name="INDEX-3342" /><a name="INDEX-3343" />Perlmodules that may not be included with your system. This appendixcontains instructions for installing modules from CPAN. It alsodiscusses how to use <em class="emphasis">perldoc</em> to accessdocumentation.</p><div class="sect1"><a name="appb-1-fm2xml" /><h2 class="sect1">B.1. CPAN</h2><p><a name="INDEX-3344" />CPAN is theComprehensive Perl Archive Network, found at <a href="http://www.cpan.org/">http://www.cpan.org/</a> and at numerous mirrorsaround the world (see <a href="http://www.cpan.org/SITES.html">http://www.cpan.org/SITES.html</a>). From CPANyou can download source code and binary distributions of Perl, plusall of the modules we mentioned in this book and many other scriptsand modules.</p><p>You can browse the very long list of modules at <a href="http://www.cpan.org/modules/00modlist.long.html">http://www.cpan.org/modules/00modlist.long.html</a>.If you know the name of a module you wish to download, then you cangenerally find it via the first word of the module's name. Forexample, you can download Digest::MD5 from <a href="http://www.cpan.org/modules/by-module/Digest/">http://www.cpan.org/modules/by-module/Digest/</a>.The filename within that directory is<em class="filename">Digest-MD5-2.09.tar.gz</em> (note that the versionnumber, 2.09, will likely change by the time you read this book).</p><a name="appb-2-fm2xml" /><div class="sect2"><h3 class="sect2">B.1.1. Installing Modules</h3><p>All Perl modules distributed <a name="INDEX-3345" /> <a name="INDEX-3346" />on CPAN follow a consistent installprocess, but some modules are easier to install than others. Somehave dependencies on other modules, and some include<a name="INDEX-3347" />C source code thatmust be compiled and often linked to other libraries on your system.</p><p>You may have difficulty compiling the modules that contain C code.Most commercial distributions of Unix do not include an ANSI Ccompiler. You can generally obtain a prebuilt binary of the<tt class="command">gcc</tt><a name="INDEX-3348" /> compiler instead.<a name="INDEX-3349" />Checksoftware archive sites specific to your platform (for example,<a href="http://www.sun.com/sunsite/">http://www.sun.com/sunsite/</a> forSolaris and <a href="http://hpux.cae.wisc.edu/">http://hpux.cae.wisc.edu/</a> for HP/UX). Linuxand BSD systems should already have the tools you need.</p><p>If you are using<a name="INDEX-3350" /> <a name="INDEX-3351" />ActiveState's release of Perlon Win32, then you can use the Perl Package Manager to downloadpre-built binary modules from ActiveState. Visit <a href="http://www.activestate.com/PPM/">http://www.activestate.com/PPM/</a> for moreinformation.</p><p>The simplest way to install modules on Unix and compatible systems isto use the CPAN.pm module. You can invoke it like this, typically asthe superuser:</p><blockquote><pre class="code"># perl -MCPAN -e shell</pre></blockquote><p>It creates an interactive shell, from which you to get informationabout modules on CPAN and install or update modules on your system.The first time you run CPAN, it will prompt you for configurationinformation that tells it what tools are available for downloadingmodules, and what CPAN mirrors to use.</p><p>Once CPAN is configured, you can install a module by simply typing<tt class="command">install</tt> followed by the name of the module:</p><blockquote><pre class="code">cpan&gt; install Digest::MD5</pre></blockquote><p>CPAN will fetch the requested module and install it. CPAN recognizesdependencies on other modules and will automatically install requiredmodules for you. There are several other commands available besides<tt class="command">install</tt>; you can get a full list by entering aquestion mark at the prompt.</p><p>Occasionally, CPAN will not be able to install a module for you. Inthat case, you will have to<a name="INDEX-3352" /> <a name="INDEX-3353" />install a module manually.On Unix and compatible systems, you should use the following stepsafter you have downloaded a module:</p><blockquote><pre class="code">$ gzip -dc Digest-MD5-2.09.tar.gz | tar xvf -$ cd Digest-MD5-2.09$ perl Makefile.PL$ make$ make test$ su# make install</pre></blockquote><p>If <tt class="command">make</tt> or <tt class="command">make test</tt> fails,then you will need to find and fix the problem. Check thedocumentation included with the module for assistance. If the moduleyou have downloaded contains C code that links to other libraries,verify that the versions of your libraries match what the Perl moduleexpects. You might also search past newsgroup postings for anyone whoalready encountered and solved the same problem. You can use<a href="http://www.deja.com/usenet/">http://www.deja.com/usenet/</a> forthis; navigate to the advanced news search and search <em class="emphasis">comp.lang.perl.modules</em> for related terms.</p><p>If you have verified any version dependencies, cannot find anyanswers in the documentation, cannot find any answers in pastnewsgroup postings, and cannot solve the problem yourself, then posta polite, detailed message to <em class="emphasis">news:comp.lang.perl.modules</em> explaining theproblem and asking for assistance. You probably should not use<em class="emphasis">deja.com</em> for this, however.Unfortunately, some of the most knowledgeable and helpful Perl codersfilter out news messages posted from <em class="emphasis">deja.com</em> (for the same reason, you may wantto avoid sending your message from a Microsoft mail <a name="INDEX-3354" />application,<a name="INDEX-3355" /><a name="INDEX-3356" />too).</p></div></div><hr align="left" width="515" /><div class="navbar"><table border="0" width="515"><tr><td width="172" valign="top" align="left"><a href="appa_06.htm"><img src="../gifs/txtpreva.gif" alt="Previous" border="0" /></a></td><td width="171" valign="top" align="center"><a href="index.htm"><img src="../gifs/txthome.gif" alt="Home" border="0" /></a></td><td width="172" valign="top" align="right"><a href="appb_02.htm"><img src="../gifs/txtnexta.gif" alt="Next" border="0" /></a></td></tr><tr><td width="172" valign="top" align="left">A.6. Newsgroups</td><td width="171" valign="top" align="center"><a href="index/index.htm"><img src="../gifs/index.gif" alt="Book Index" border="0" /></a></td><td width="172" valign="top" align="right">B.2. perldoc</td></tr></table></div><hr align="left" width="515" /><img src="../gifs/navbar.gif" alt="Library Navigation Links" usemap="#library-map" border="0" /><p><font size="-1"><a href="copyrght.htm">Copyright &copy; 2001</a> O'Reilly &amp; Associates. All rights reserved.</font></p><map name="library-map"><area href="../index.htm" coords="1,1,83,102" shape="rect" /><area href="../lnut/index.htm" coords="81,0,152,95" shape="rect" /><area href="../run/index.htm" coords="172,2,252,105" shape="rect" /><area href="../apache/index.htm" coords="238,2,334,95" shape="rect" /><area href="../sql/index.htm" coords="336,0,412,104" shape="rect" /><area href="../dbi/index.htm" coords="415,0,507,101" shape="rect" /><area href="../cgi/index.htm" coords="511,0,601,99" shape="rect" /></map></body></html>

⌨️ 快捷键说明

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