Obtaining Perl

To install Perl on your system, you have three choices:

  • Install a vendor package

  • Download and install a prebuilt binary version

  • Download, compile, and install the source-code version

Installing a Vendor Package

If you're using a free variety of Unix (Linux, FreeBSD, or OpenBSD) your vendor probably supplies a vendor-created package designed for your system. Usually, when you install these operating systems, you have the option of installing Perl along with the rest of the operating system. They also provide tools that enable you to download and install updated packages. For example, Red Hat provides many third-party applications as RPM files. You can use any RPM tool to download and install Perl on your system. Most free Unixes have similar systems.

For more information on these types of packages, see your vendor's Web site. If such a system is available, you'll definitely want to look into installing Perl that way rather than using the following methods. These systems generally make it easy to uninstall and update packages, so it's best to use them when you can.

Getting Binaries

Installing a binary version is the simpler than installing Perl—you don't need to compile anything, just unpack and go. However, binaries are only available for a very few Unix platforms, they tend to lag behind the current version of the Perl source code, and there is a danger of viruses or other nasties being hidden in the binary versions if you don't get them from a reputable source. Building the Perl source code is not difficult, and if you use Unix for any extensive period of time you'll probably end up doing a lot anyhow. Plus, with the source code you'll always end up with the latest and greatest versions. If you can't get a vendor-supplied package, building Perl from source is the preferred method of getting Perl installed on your system.

Another place to look, particularly for Solaris and Linux software, is the archive at http://ibiblio.org/pub/, formerly called Sunsite. Check in http://ibiblio.org/pub/packages/solaris/sparc for Solaris software, and http://ibiblio.org/pub/Linux for Linux.

Different companies and sites have different ways of packaging their binaries; you'll need to follow the directions for each site to discover how to install the Perl binaries on your system. You might find that with tracking down binaries and figuring out how to install them that it was easier to just go the source code route in the first place.

Getting Source (and Related Tools)

To compile and install Perl from the source code, there are several other things you'll need in addition to the Perl code itself: tar and gzip to unpack the source archive, and a C compiler to compile the source. The Perl installation will also go most smoothly if you have superuser (root) access on the computer on which Perl will be installed. If you're not the system administrator for the computer on which you need to run Perl, you'll probably be better off tracking down the person who is, and asking him to do it.

To expand the Perl archive you'll need tar and gzip. The tar utility is present on almost every Unix machine. Most Unix computers also have gzip installed, especially if they're running a free version of Unix such as FreeBSD or Linux. If you don't have these utilities, you'll need to locate them on the Internet, download them, and install them. As with the Perl binaries, it's likely that the vendor of your Unix system can provide you with access to these tools, or if your Unix system came on a CD-ROM they might have been bundled with that CD-ROM. Solaris users can download precompiled GNUtar and gzip packages from SunSite at http://metalab.unc.edu/pub/packages/solaris/sparc.

Second, you'll also need a C compiler. It is likely that the computer you're using will have either cc or gcc installed (type cc or gcc at a prompt and see what happens). If you can't locate a C compiler on your system, you should contact your system administrator about locating or installing one. Again, C compilers are almost always installed by default with free Unix systems, and are also installed with many popular commercial Unix variants. Solaris users can download precompiled versions of gcc at the SunSite URL mentioned previously.

When you're sure that you have all the tools required to successfully install Perl, you can download the Perl source code. The easiest way to get it is to simply point your Web browser to www.perl.com, which keeps the latest stable version of Perl at http://www.perl.com/CPAN/src/stable.tar.gz.

The stable.tar.gz package contains the C source code, which should compile successfully on nearly every Unix platform. As I write this, that's version 5.6.1, and that's the version this book covers. If you're feeling really adventurous, you can download the new experimental developer's version of Perl at http://www.perl.com/CPAN/src/devel.tar.gz. The developer's version is currently version 5.7.2 (but has most likely changed by the time you read this). You should only use it if you already know Perl, know what you're doing, want to check out some of the newer features, and are willing to put up with some odd behavior.

All the .gz packages are in binary format, so make sure you download them as binary files. If you download them in text format, they won't decompress (if you use a browser to download them, you don't have to worry about this).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset