0.3. The Standard Distribution
Most operating system vendors these days include Perl as a standard component of their systems. As of this writing, AIX, BeOS, BSDI, Debian, DG/UX, DYNIX/ptx, FreeBSD, IRIX, LynxOS, Mac OS X, OpenBSD, OS390, RedHat, SINIX, Slackware, Solaris, SuSE, and Tru64 all came with Perl as part of their standard distributions. Some companies provide Perl on separate CDs of contributed freeware or through their customer service groups. Third-party companies like ActiveState offer prebuilt Perl distributions for a variety of different operating systems, including those from Microsoft.
Even if your vendor does ship Perl as standard, you'll probably eventually want to compile and install Perl on your own. That way you'll know you have the latest version, and you'll be able to choose where to install your libraries and documentation. You'll also be able to choose whether to compile Perl with support for optional extensions such as multithreading, large files, or the many low-level debugging options available through the -D command-line switch. (The user-level Perl debugger is always supported.)
The easiest way to download a Perl source kit is probably to point your web browser to Perl's home page at www.perl.com, where you'll find download information prominently featured on the start-up page, along with links to precompiled binaries for platforms that have misplaced their C compilers.
You can also head directly to CPAN (the Comprehensive Perl Archive Network, described in Chapter 22, "CPAN"), using http://www.perl.com/CPAN or http://www.cpan.org. If those are too slow for you (and they might be because they're very popular), you should find a mirror close to you. The following URLs are just a few of the CPAN mirrors around the world, now numbering over one hundred:
The first pair in that list, those at the funet.fi site, point to the master CPAN repository. The MIRRORED.BY file there contains a list of all other CPAN sites, so you can just get that file and then pick your favorite mirror. Some of them are available through FTP, others through HTTP (which makes a difference behind some corporate firewalls). The http://www.perl.com/CPAN multiplexor attempts to make this selection for you. You can change your selection if you like later.http://www.funet.fi/pub/languages/perl/CPAN/ ftp://ftp.funet.fi/pub/languages/perl/CPAN/ ftp://ftp.cs.colorado.edu/pub/perl/CPAN/ ftp://ftp.cise.ufl.edu/pub/perl/CPAN/ ftp://ftp.perl.org/pub/perl/CPAN/ http://www.perl.com/CPAN-local http://www.cpan.org/ http://www.perl.org/CPAN/ http://www.cs.uu.nl/mirror/CPAN/ http://CPAN.pacific.net.hk/
Once you've fetched the source code and unpacked it into a directory, you should read the README and the INSTALL files to learn how to build Perl. There may also be an INSTALL.platform file for you to read there, where platform represents your operating system platform.
If your platform happens to be some variety of Unix, then your commands to fetch, configure, build, and install Perl might resemble what follows. First, you must choose a command to fetch the source code. You can fetch with ftp:
(Again, feel free to substitute a nearby CPAN mirror. Of course, if you live in Finland, that is your nearby CPAN mirror.) If you can't use ftp, you can download via the Web using a browser or a command-line tool:% ftp ftp://ftp.funet.fi/pub/languages/perl/CPAN/src/latest.tar.gz
Now unpack, configure, build, and install:% wget http://www.funet.fi/pub/languages/perl/CPAN/src/latest.tar.gz
This uses a conventional C development environment, so if you don't have a C compiler, you can't compile Perl. See the CPAN ports directory for up-to-date status on each platform to learn whether Perl comes bundled (and if so, what version), whether you can get by with the standard source kit, or whether you need a special port. Download links are given for those systems that typically require special ports or for systems from vendors who normally don't provide a C compiler (or rather, who abnormally don't provide a C compiler).% tar zxf latest.tar.gz Or gunzip first, then tar xf. % cd perl-5.6.0 Or 5.* for whatever number. % sh Configure -des Assumes default answers. % make test && make install Install typically requires superuser.
Copyright © 2002 O'Reilly & Associates. All rights reserved.