Programming Perl, Second Edition

Previous Chapter 8 Next
 

8.5 Distribution and Installation

You should see the Preface of this book for how to fetch and build a Perl kit for your system. Specific installation instructions come in the README file of the Perl distribution kit. Typically, you'll get the Perl kit either as a tar file or as a set of shar (shell archive) scripts.[4] A .Z extension indicates you need to uncompress the file first. A .gz extension indicates you need to gunzip the file first. You then unpack the file as appropriate, read the README file and run a massive shell script called Configure, which tries to figure out everything about your system. After this is done, you do a series of "makes" to find header file dependencies, to compile Perl (and a2p), to run regression tests, and to install Perl in your system directories.

[4] Operating systems other than UNIX may have special instructions, in which case you should follow them instead of what's in this section. Look for a file named README.xxx, where xxx is your OS name.

It's possible you'll get a copy of Perl that is already compiled. You'll have to make sure you get suidperl, a2p, and s2p as well, and the Perl library routines (see Chapter 7, The Standard Perl Library). Install these files in the directories that your version was compiled for. Note: binary distributions of Perl are made available because they're handy, not because you are restricted from getting the source and compiling it yourself. The people who give you the binary distribution ought to provide you with some form of access to the source, if only a pointer to where they got the source from. See the Copying file in the distribution for more information.

Translation from Awk and Sed

Along with the Perl distribution come three translators: a2p, which translates awk (1) (not necessarily nawk (1)) scripts to Perl; s2p, which translates sed (1) scripts to Perl; and find2perl, which translates find (1) commands to Perl. These translators don't necessarily produce idiomatic Perl, but you can use the output as a starting place. The translators can also help you see how the features of other languages map into those of Perl.

The a2p translator is written in C, so it is compiled and installed automatically along with Perl. The s2p and find2perl translators are themselves written in Perl, so no further compilation is necessary. They are installed automatically when Perl is installed. They are described more fully in Chapter 6, Social Engineering.

Examples

The Perl source distribution comes with some sample scripts in the eg/ subdirectory. Feel free to browse among them and use them. They are not installed automatically, however, so you'll need to copy them to the appropriate directory, and possibly fix the #! line to point to the right interpreter.

The files in the t/ and lib/ subdirectories, although incredibly arcane in spots, can also serve as examples.

The examples in this book are also available for anonymous FTP from ftp.ora.com and the scripts subdirectory of CPAN. (See the Preface for more information about CPAN.)

Patches

Since Perl is constantly being honed and improved, Larry occasionally posts patches through CPAN. Your distribution is likely to have had most of the patches applied already--check the output of perl -v to see the current patchlevel of your distribution.

Bug reports may be reported by invoking the perlbug command, included with the Perl distribution.

Patches are sent out with complete instructions on how to apply them. You'll want to have the patch program handy. (This program was written in self-defense by Larry when he couldn't persuade people to apply (in order and by hand) all his rn patches, resulting in cascading chaotic catastrophes around the world.) The patch program is available from the GNU project, because they have taken over the maintenance (the patching of patch, how quaint) after Larry got a little more busy with Perl.


Previous Home Next
Programming with Style Book Index Perl Poetry