Web Server Programming
Chapter 5
Perl
Larry Wall is a guru for many in the computer programming community. He has is own personal section with essays, interviews, and commentaries (on Perl and much else besides) at the main Perl site associated with O'Reilly press.
If you search on Google you will find many other interviews with Larry Wall that have been published in web-based journals.
Unix and Linux users will have a version of Perl already installed. Windows users have the choice of installing CygWin, or ActivePerl
CygWin gives you a more or less complete Linux environment that runs within Windows. You double click on the CygWin icon and up pops a console window from where you can control your quasi-Linux system. This is easier for many users than configuring their machine as a dual-boot system running both Windows (for the games and Microsoft Office) and Linux. The Cygwin system comes with standard Linux components including gcc and g++ compilers, Apache, Postgres database, and of course Perl. (The CygWin download is large; this is another case where it might be faster to purchase the CD version on-line and wait for it to be delivered by mail.)
The ActivePerl download gives you a good version of Perl that runs within Windows and which can be utilized for CGI programs launched from Apache. Versions available include a current build of the 5.6 Perl and a newer 5.8 Perl.
The ActivePerl download is one of these "msi" self installing programs so installation is trivial.
Irrespective of whether you use Windows or Linux versions of Perl, it is likely that you will have to install extra modules. These extra modules would typically include things like components needed to access databases, but there are other modules that you might want such as those for XML parsers, or SOAP-related modules. A Perl release, like the ActivePerl release, should come with a Perl Package Manager utility program (PPM - which apparently now has a preferred alias "Programmer's Package Manager"). PPM is used to install a module into your system; it can also be used as an Internet client that accesses major repositories so that you can search for modules that you need.
Instructions on the use
of ActivePerl's
PPM
are available on-line (and are also included in the
download package). While you can use PPM as your client and search the repositories,
most will find it easier to use a browser and go to
a site like Active State's package
page
(e.g. the
page for Perl 5.6 modules)
where individual modules are listed and are available for ftp download. Once you have downloaded
your package, you can install it locally with PPM.
(For example, if you download DBI.zip, then you would decompress it into some temporary directory.
Use a Command Prompt shell, cd to the temporary directory with the decompressed DBI files, and
issue the command ppm install dbi.ppd)
Perl is well supported on-line. In addition to the site associated with O'Reilly publishers and the ActivePerl site, there is CPAN: The Comprehensive Perl Archive Network.. This contains a very large collection of contributed Perl scripts and modules. It appears to be a remarkably active site; it has a page that covers "New items - things contributed in last seven days", when checked this page contained some 1400 items! (Maybe something is slightly amiss there.)
The Perl Institute or Perl Mongers site is another major site for advocacy of Perl programming. Yahoo has an extensive list of links for Perl programming; the contents have substantial overlap with the similar list at Google.
Tutorials on-line include many at Perl.com including for example a tutorial on DBI. The Perl Monks offer many on-line tutorials including basics, files and databases, and CGI programming.
A few of the examples from the text are available.
The suggested exercises for Perl include programs to analyze Apache log files. It is probably more useful to use log files from one of your local servers, but if you are working entirely on your own machine then you won't have access to decent sized logs. An example gzip compressed Apache Log is available; this has something like 16000 access entries which should be sufficient to test a program for data extraction and report generation.