📄 ch24.htm
字号:
<HTML>
<HEAD>
<TITLE>Chapter 24 -- Building and Installing the
Perl 5 Interpreter</TITLE>
<META NAME="GENERATOR" CONTENT="Mozilla/3.0b5aGold (WinNT; I) [Netscape]">
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000EE" VLINK="#551A8B" ALINK="#CE2910">
<H1><FONT COLOR=#FF0000>Chapter 24</FONT></H1>
<H1><B><FONT SIZE=5 COLOR=#FF0000>Building and Installing the
Perl 5 Interpreter</FONT></B>
</H1>
<P>
<HR WIDTH="100%"></P>
<P>
<H3 ALIGN=CENTER><FONT COLOR="#000000"><FONT SIZE=+2>CONTENTS<A NAME="CONTENTS"></A>
</FONT></FONT></H3>
<UL>
<LI><A HREF="#GettingPerl5" >Getting Perl 5</A>
<UL>
<LI><A HREF="#GettingPerlfromtheInternet" >Getting Perl from the Internet</A>
<LI><A HREF="#GettingPerlviaEmail" >Getting Perl via E-mail</A>
<LI><A HREF="#WebSiteswithPerlInformation" >Web Sites with Perl Information</A>
<LI><A HREF="#OnCDROM" >On CD-ROM</A>
</UL>
<LI><A HREF="#InstallingPerlonMostUNIXSystems" >Installing Perl on Most UNIX Systems</A>
<UL>
<LI><A HREF="#ConfiguringYourPerlDistribution" >Configuring Your Perl Distribution</A>
<LI><A HREF="#MakingDependencies" >Making Dependencies</A>
<LI><A HREF="#WhatArehintsFiles" >What Are hints Files?</A>
</UL>
<LI><A HREF="#RunningSomeTests" >Running Some Tests</A>
<UL>
<LI><A HREF="#FinishingItUp" >Finishing It Up</A>
<LI><A HREF="#ConfirmingtheInstallation" >Confirming the Installation</A>
</UL>
<LI><A HREF="#TheDOSPlatform" >The DOS Platform</A>
<LI><A HREF="#OtherPlatforms" >Other Platforms</A>
<LI><A HREF="#LinuxASpecialCaseforPerl5" >Linux: A Special Case for Perl 5</A>
<UL>
<LI><A HREF="#PartialUpgradesofYourLinuxKernel" >Partial Upgrades of Your Linux Kernel for Getting Perl Running</A>
<LI><A HREF="#TheRealDangerDuringthePartialUpgra" >The Real Danger During the Partial Upgrade</A>
</UL>
<LI><A HREF="#Summary" >Summary</A>
</UL>
<HR>
<P>
This chapter covers the gory details of installing Perl 5 on a
given system. First, you find out where to get the distributions
via the Internet. Then you learn the details of some of the things
you need to do to get the Perl 5 package built and installed on
to your machine. I cover building the sources for a UNIX system
here in detail because this is what most of the sources are targeted
for anyway. However, I also cover how to get Perl 5 on other platforms.
<H2><A NAME="GettingPerl5"><B><FONT SIZE=5 COLOR=#FF0000>Getting
Perl 5</FONT></B></A></H2>
<P>
There are several ways to get the Perl 5 package for your system.
Some of the ways include buying a commercial package, getting
it from the Internet via FTP or e-mail, or having someone else
get it for you.
<H3><A NAME="GettingPerlfromtheInternet"><B>Getting Perl from
the Internet</B></A></H3>
<P>
The latest Perl packages are usually available from any <TT><FONT FACE="Courier">comp.sources.misc</FONT></TT>
archive on a given news site. The latest source distribution will
almost always be at Larry Wall's site. Here's the address:
<BLOCKQUOTE>
<TT><FONT FACE="Courier"><A HREF="ftp://ftp.sems.com/pub/outgoing/perl5.0/" tppabs="ftp://ftp.sems.com/pub/outgoing/perl5.0/">ftp://ftp.sems.com/pub/outgoing/perl5.0/</A></FONT></TT>
</BLOCKQUOTE>
<P>
Larry Wall maintains the official distribution site (for both
<TT><FONT FACE="Courier">perl4.036</FONT></TT> and <TT><FONT FACE="Courier">perl5</FONT></TT>)
at his site. Always check this site first for the latest versions
and, if you are the brave sort, for the beta releases being worked
on.
<P>
A number of archives have materialized over the years, and these
archives hold Perl source code and related items. Probably the
largest archive is at the University of Florida. The Comprehensive
Perl Archive Network (CPAN) is a collection of all Perl materials
including source files, modules, and documentation. In order of
probability, these other sites should also have the Perl source
files:
<BLOCKQUOTE>
<TT><FONT FACE="Courier"><A HREF="ftp://ftp.cis.ufl.edu/pub/perl/src/5.0/" tppabs="ftp://ftp.cis.ufl.edu/pub/perl/src/5.0/">ftp://ftp.cis.ufl.edu/pub/perl/src/5.0/</A>
<BR>
<A HREF="ftp://ftp.cbi.tamucc.edu/pub/duff/Perl/" tppabs="ftp://ftp.cbi.tamucc.edu/pub/duff/Perl/">ftp://ftp.cbi.tamucc.edu/pub/duff/Perl/</A><BR>
<A HREF="ftp://ftp.metronet.com/pub/perl/sources/" tppabs="ftp://ftp.metronet.com/pub/perl/sources/">ftp://ftp.metronet.com/pub/perl/sources/</A><BR>
<A HREF="ftp://genetics.upenn.edu/perl5/" tppabs="ftp://genetics.upenn.edu/perl5/">ftp://genetics.upenn.edu/perl5/</A><BR>
<A HREF="ftp://ikra.com/pub/perl5" tppabs="ftp://ikra.com/pub/perl5">ftp://ikra.com/pub/perl5</A></FONT></TT>
</BLOCKQUOTE>
<P>
By the time you get this book, this listing might be superseded
by newer sites. The best course of action is to use <TT><FONT FACE="Courier">archie</FONT></TT>
or a Web search site such as Yahoo to search for the words <I>Perl,
CPAN,</I> or <I>Perl5</I> to get the list of the latest versions
of Perl 5 packages.
<H3><A NAME="GettingPerlviaEmail"><B>Getting Perl via E-mail</B></A>
</H3>
<P>
If you do not have direct FTP access, all is not lost. You can
get the packages via e-mail. Table 24.1 is a small list of known
FTP mail sites. As a general rule, you should always attempt to
use the site closest to you with the FTP archive closest to it.
Many of these sites already have Perl on them.
<P>
For information on how to use one of these sites, send e-mail
containing the word <I>help</I> to the address.<BR>
<P>
<CENTER><B>Table 24.1. Location of e-mail addresses that have
Perl.</B></CENTER>
<CENTER>
<TABLE BORDERCOLOR=#000000 BORDER=1 WIDTH=80%>
<TR VALIGN=TOP><TD WIDTH=118><I>Location</I></TD><TD WIDTH=291><I>E-mail Address</I>
</TD></TR>
<TR VALIGN=TOP><TD WIDTH=118>Massachusetts</TD><TD WIDTH=291><TT><FONT FACE="Courier">ftpmail@decwrl.dec.com</FONT></TT>
</TD></TR>
<TR VALIGN=TOP><TD WIDTH=118>New Jersey</TD><TD WIDTH=291><TT><FONT FACE="Courier">bitftp@pucc.princeton.edu</FONT></TT>
</TD></TR>
<TR VALIGN=TOP><TD WIDTH=118>North Carolina</TD><TD WIDTH=291><TT><FONT FACE="Courier">ftpmail@sunsite.unc.edu</FONT></TT>
</TD></TR>
<TR VALIGN=TOP><TD WIDTH=118>Germany</TD><TD WIDTH=291><TT><FONT FACE="Courier">ftpmail@ftp.uni-stuttgart.de</FONT></TT>
</TD></TR>
<TR VALIGN=TOP><TD WIDTH=118>UK</TD><TD WIDTH=291><TT><FONT FACE="Courier">ftpmail@doc.ic.ac.uk</FONT></TT>
</TD></TR>
<TR VALIGN=TOP><TD WIDTH=118>Australia</TD><TD WIDTH=291><TT><FONT FACE="Courier">ftpmail@cs.uow.edu.au</FONT></TT>
</TD></TR>
</TABLE></CENTER>
<P>
<P>
Send a message to <TT><FONT FACE="Courier">mail-server@cs.ruu.nl</FONT></TT>
containing this:
<BLOCKQUOTE>
<TT><FONT FACE="Courier">begin<BR>
path your_email_address<BR>
send help<BR>
send PERL/perl5.0/INDEX<BR>
end</FONT></TT>
</BLOCKQUOTE>
<P>
You can omit the <TT><FONT FACE="Courier">path</FONT></TT> line
if your message contains a normal <TT><FONT FACE="Courier">From:</FONT></TT>
line. You'll receive a help file and an index of the directory
that contains the Perl materials.
<H3><A NAME="WebSiteswithPerlInformation"><B>Web Sites with Perl
Information</B></A></H3>
<P>
The following Web sites contain information on Perl 5. You can
get more listings by using the Net search facilities on the Web
by searching for the keyword <I>Perl5</I>.
<BLOCKQUOTE>
<TT><A HREF="http://www.metronet.com/perlinfo/perl5.html" tppabs="http://www.metronet.com/perlinfo/perl5.html">http://www.metronet.com/perlinfo/perl5.html</A>
<BR>
<A HREF="http://www-cgi.cs.cmu.edu/cgi-bin/perl-man" tppabs="http://www-cgi.cs.cmu.edu/cgi-bin/perl-man">http://www-cgi.cs.cmu.edu/cgi-bin/perl-man</A><BR>
http:://www.perl.com/<BR>
<A HREF="http://src.doc.ic.ac.uk/packages/perl5" tppabs="http://src.doc.ic.ac.uk/packages/perl5">http://src.doc.ic.ac.uk/packages/perl5</A></TT>
</BLOCKQUOTE>
<P>
Naturally, your Web search tool will return a different list of
directories. These sites will get you started at the very least.
<P>
The FAQ for Perl 5 is available at this site:
<BLOCKQUOTE>
<TT><A HREF="http://mox.perl.com/perl/faq" tppabs="http://mox.perl.com/perl/faq">http://mox.perl.com/perl/faq</A></TT>
</BLOCKQUOTE>
<H3><A NAME="OnCDROM"><B>On CD-ROM</B></A></H3>
<P>
The best collection I've found to date is the InfoMagic release
of the CD-ROM <I>Mother of Perl</I>. This two-disc set includes
the archives, mailing list archives, and lots of mirrors of CPAN
sites. My disc was up to 5.001m, but a more current disc set should
be available at the time this book goes to print. For more information
contact InfoMagic at this address:
<BLOCKQUOTE>
<TT><FONT FACE="Courier">InfoMagic<BR>
Box 30370<BR>
Flagstaff, AZ 86003<BR>
520-526-9565<BR>
www.infomagic.com</FONT></TT>
</BLOCKQUOTE>
<H2><A NAME="InstallingPerlonMostUNIXSystems"><B><FONT SIZE=5 COLOR=#FF0000>Installing
Perl on Most UNIX Systems</FONT></B></A></H2>
<P>
Installing Perl takes time, but it's easy. I cover the installation
on a UNIX-based system because this covers the most general installations
of Perl. Please check the section titled "Other Platforms"
for more instructions if you are not on a UNIX platform.
<P>
Here are the basic steps to follow:
<OL>
<LI>Make sure you have all the files.
<LI>Configure your Perl distribution for your system.
<LI>Construct the dependencies.
<LI>Make the executables in your local directory.
<LI>Run a test version to see if everything is okay.
<LI>If everything checks out, make the distribution available
to the rest of the users on your machine.
</OL>
<P>
First, unzip and untar the Perl 5 package in a directory not in
the <TT><FONT FACE="Courier">/usr</FONT></TT> directory tree.
You'll install this distribution in the <TT><FONT FACE="Courier">/usr</FONT></TT>
or <TT><FONT FACE="Courier">/usr/local</FONT></TT> later. For
now, just use a subdirectory in your home directory.
<P>
Go to the directory where you downloaded your Perl distribution.
Then unzip and untar the distribution files with these commands:
<BLOCKQUOTE>
<TT><FONT FACE="Courier">$ <B>gunzip</B> <I><B>XXXX</B></I>.<B>tar.gz
<BR>
</B>$ <B>tax -cvf <I>XXXX</I>.tar</B></FONT></TT>
</BLOCKQUOTE>
<P>
where <TT><I><FONT FACE="Courier">XXXX</FONT></I></TT> is the
name of the Perl distribution you got from the Internet. At the
time this book was written, this was <TT><FONT FACE="Courier">perl5.002.tar.gz</FONT></TT>.
The <TT><FONT FACE="Courier">5.002</FONT></TT> version is installed
and used for all examples in this book.
<P>
The <TT><FONT FACE="Courier">INSTALL</FONT></TT> file is the master
document you need to refer to if this chapter does not get you
started. The text in the <TT><FONT FACE="Courier">INSTALL</FONT></TT>
file is in the plain old documentation (pod) format. Run <TT><FONT FACE="Courier">pod2man</FONT></TT>
to get the documentation in the <TT><FONT FACE="Courier">man</FONT></TT>
page format.
<P>
The <TT><FONT FACE="Courier">MANIFEST</FONT></TT> file should
contain the information you need on what files go where. The files
after untarring the package should look like those shown in Listing
24.1.
<P>
Your Perl directory should contain the following source files
after you untar the package:
<HR>
<BLOCKQUOTE>
<B>Listing 24.1. </B><TT><B><FONT FACE="Courier">MANIFEST</FONT></B></TT><B>
files content list. <BR>
</B>
</BLOCKQUOTE>
<BLOCKQUOTE>
<TT><FONT FACE="Courier">Artistic configure hints op.h proto.h
<BR>
Changes cop.h hv.c opcode.h regcomp.c
<BR>
Changes.Conf cv.h hv.h opcode.pl regcomp.h
<BR>
Configure deb.c installman os2 regexec.c
<BR>
Copying doio.c installperl patchlevel.h regexp.h
<BR>
EXTERN.h doop.c interp.sym perl.c run.c
<BR>
INSTALL dosish.h keywords.h perl.h scope.c
<BR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -