📄 ch01_03.htm
字号:
<html><head><title>How Can I Get Perl? (Learning Perl, 3rd Edition)</title><link rel="stylesheet" type="text/css" href="../style/style1.css" /><meta name="DC.Creator" content="Randal L. Schwartz and Tom Phoenix" /><meta name="DC.Format" content="text/xml" scheme="MIME" /><meta name="DC.Language" content="en-US" /><meta name="DC.Publisher" content="O'Reilly & Associates, Inc." /><meta name="DC.Source" scheme="ISBN" content="0596001320L" /><meta name="DC.Subject.Keyword" content="stuff" /><meta name="DC.Title" content="Learning Perl, 3rd Edition" /><meta name="DC.Type" content="Text.Monograph" /></head><body bgcolor="#ffffff"><img alt="Book Home" border="0" src="gifs/smbanner.gif" usemap="#banner-map" /><map name="banner-map"><area shape="rect" coords="1,-2,616,66" href="index.htm" alt="Learning Perl, 3rd Edition" /><area shape="rect" coords="629,-11,726,25" href="jobjects/fsearch.htm" alt="Search this book" /></map><div class="navbar"><table width="684" border="0"><tr><td align="left" valign="top" width="228"><a href="ch01_02.htm"><img alt="Previous" border="0" src="../gifs/txtpreva.gif" /></a></td><td align="center" valign="top" width="228"><a href="index.htm"></a></td><td align="right" valign="top" width="228"><a href="ch01_04.htm"><img alt="Next" border="0" src="../gifs/txtnexta.gif" /></a></td></tr></table></div><h2 class="sect1">1.3. How Can I Get Perl?</h2><p>You probably already have it. At least, we find<a name="INDEX-29" />Perlwherever <em class="emphasis">we</em> go. It ships with many systems, andsystem administrators often install it on every machine at theirsite.<a href="#FOOTNOTE-20">[20]</a> But if you can't findit already on your system, you can still get it for free.</p><blockquote class="footnote"> <a name="FOOTNOTE-20" /><p>[20]Well, each machine that is made forprogramming, at least.</p> </blockquote><p>Perl is distributed under two different <a name="INDEX-30" /><a name="INDEX-31" />licenses. For most people, sinceyou'll merely be <em class="emphasis">using</em> it, either licenseis as good as the other. If you'll be modifying Perl, however,you'll want to read the licenses more closely, because they putsome small restrictions on distributing the modified code. For peoplewho won't modify Perl, the licenses essentially say"it's free -- have fun with it."</p><p>In fact, it's not only free, but it runs rather nicely onnearly everything that calls itself Unix and has a C compiler. Youdownload it, type a command or two, and it starts configuring andbuilding itself. Or, better yet, you get your system administrator totype those two commands and install it for you.<a href="#FOOTNOTE-21">[21]</a></p><blockquote class="footnote"> <a name="FOOTNOTE-21" /><p>[21]Ifsystem administrators can't install software, what good arethey? If you have trouble convincing your admin to install Perl,offer to buy a pizza. We've never met a sys admin who could sayno to a free pizza, or at least counter-offer with something just aseasy to get.</p> </blockquote><p>Besides Unix and Unix-like systems, people have also been addictedenough to Perl to port it to other systems, like theMacintosh,<a href="#FOOTNOTE-22">[22]</a> VMS,OS/2, even MS/DOS and every modern species of Windows -- andprobably even more by the time you read this.<a href="#FOOTNOTE-23">[23]</a> Many of these <em class="firstterm">ports</em>of Perl come with an installation program that's even easier touse than the process for installing Perl on Unix. Check for links inthe "ports" section on CPAN.</p><blockquote class="footnote"> <a name="FOOTNOTE-22" /><p>[22]MacPerl runs under the"classic" Mac OS. If you have Mac OS X, which is aUnix-based system, you have mainstream Perl.</p> </blockquote><blockquote class="footnote"> <a name="FOOTNOTE-23" /><p>[23]And no,as we write this, it won't fit in your Palmhandheld -- it's just too darn big, even strippeddown.</p> </blockquote><a name="lperl3-CHP-1-SECT-3.1" /><div class="sect2"><h3 class="sect2">1.3.1. What Is CPAN?</h3><p><em class="firstterm">CPAN</em> is the <a name="INDEX-32" /><a name="INDEX-33" />Comprehensive PerlArchive Network, your one-stop shopping for Perl. It has the sourcecode for Perl itself, ready-to-install ports of Perl to all sorts ofnon-Unix systems,<a href="#FOOTNOTE-24">[24]</a> examples, documentation,extensions to Perl, and archives of messages about Perl. In short,CPAN is comprehensive.</p><blockquote class="footnote"> <a name="FOOTNOTE-24" /><p>[24]It's nearly always better tocompile Perl from the source on Unix systems. Other systems may nothave a C compiler and other tools needed for compilation, so CPAN hasbinaries for these.</p> </blockquote><p>CPAN is replicated on hundreds of mirror machines around the world;start at<a name="INDEX-34" /><a href="http://www.cpan.org/">http://www.cpan.org/</a> to find one near you.Most of the time, you can also simply visit <em class="emphasis">http://<tt class="literal">COUNTRYCODE</tt>.cpan.org/</em> where<tt class="literal">COUNTRYCODE</tt> is your two-letter official countrycode (like on the end of your national domain names). Or, if youdon't have access to the Net, you might find a CD-ROM orDVD-ROM with all of the useful parts of CPAN on it; check with yourlocal technical bookstore. Look for a recently minted archive,though; since CPAN changes daily, an archive from two years ago is anantique. (Better yet, get a kind friend with Net access to burn youone with today's CPAN.)</p><p>CPAN is pretty-well organized; most of the time, you should find whatyou want with just a few clicks of the mouse. But there's alsoa couple of nice search interfaces on the Webat<a name="INDEX-35" /> <a href="http://search.cpan.org/">http://search.cpan.org/</a> and <a href="http://kobesearch.cpan.org/">http://kobesearch.cpan.org/</a>,which areespecially helpful when you're looking for an extension toPerl.</p></div><a name="lperl3-CHP-1-SECT-3.2" /><div class="sect2"><h3 class="sect2">1.3.2. How Can I Get Support for Perl?</h3><p><a name="INDEX-36" /> <a name="INDEX-37" />Well, you get the complete source -- soyou get to fix the <a name="INDEX-38" /><a name="INDEX-39" />bugs yourself!</p><p>That doesn't sound so good, does it? But it really is a goodthing. Since there's no "source code escrow" onPerl, anyone can fix a bug -- in fact, by the time you'vefound and verified a bug, someone else has probably already got a fixfor it. There are thousands of people around the world who help tomaintain Perl.</p><p>Now, we're not saying that Perl has a lot of bugs. Butit's a program, and every program has at least onebug.<a href="#FOOTNOTE-25">[25]</a></p><blockquote class="footnote"> <a name="FOOTNOTE-25" /><p>[25]Programmers also know that every program has atleast one line of unnecessary source code. By combining these tworules and using logical induction, it's a simple matter toprove that any program could be reduced to a single line of code witha bug.</p> </blockquote><p>To see why it's so useful to have the source to Perl, imaginethat instead of using Perl, you licensed a programming languagecalled Forehead from a giant, powerful corporation owned by azillionaire with a bad haircut. (This is all hypothetical. Everyoneknows there's no such programming language as Forehead.) Nowthink of what you can do when you find a bug in Forehead. First, youcan report it; second, you can hope -- hope that they fix the bug,hope that they fix it <em class="emphasis">soon</em>, hope that theywon't charge too much for the new version. You can hope thatthe new version doesn't add new features with new bugs, andhope that the giant company doesn't get broken up in ananti-trust lawsuit.</p><p>But with Perl, you've got the source. In the rare and unlikelyevent that you can't get a bug fixed any other way, you canhire a programmer or ten and get to work. For that matter, if you buya new machine that Perl doesn't yet run on, you can port ityourself. Or if you need a feature that doesn't yet exist,well, you know what to do.</p></div>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -