Installation of mod_perl and all the required packages is much easier with the help of the CPAN.pm module, which provides, among other features, a shell interface to the CPAN repository (see the Preface).
First, download the Apache source code and unpack it into a directory (the name of which you will need very soon).
Now execute:
panic% perl -MCPAN -eshell
You will see the cpan prompt:
cpan>
All you need to do to install mod_perl is to type:
cpan> install mod_perl
You will see something like the following:
Running make for DOUGM/mod_perl-1.xx.tar.gz Fetching with LWP: http://www.cpan.org/authors/id/DOUGM/mod_perl-1.xx.tar.gz CPAN.pm: Going to build DOUGM/mod_perl-1.xx.tar.gz
(As with earlier examples in this book, we use x.xx as a placeholder for real version numbers, because these change very frequently.)
CPAN.pm will search for the latest Apache sources and suggest a directory. If the CPAN shell did not find your version of Apache and suggests the wrong directory name, type the name of the directory into which you unpacked Apache:
Enter 'q' to stop search Please tell me where I can find your apache src [../apache_1.3.xx/src]
Answer yes to the following questions, unless you have a good reason not to:
Configure mod_perl with /home/stas/src/apache_1.3.xx/src ? [y] Shall I build httpd in /home/stas/src/apache_1.3.xx/src for you? [y]
After you have built mod_perl and Apache, tested mod_perl, and installed its Perl modules, you can quit the CPAN shell and finish the installation. Go to the Apache source root directory and run:
cpan> quit panic% cd /home/stas/src/apache_1.3.xx panic% make install
This will complete the installation by installing Apache's headers and the httpd binary into the appropriate directories.
The only caveat of the process we've just described is that you don't have control over the configuration process. But that problem is easy to solve—you can tell CPAN.pm to pass whatever parameters you want to perl Makefile.PL. You do this with the o conf makepl_arg command:
cpan> o conf makepl_arg 'DO_HTTPD=1 USE_APACI=1 EVERYTHING=1'
If you had previously set makepl_arg to some value, you will probably want to save it somewhere so that you can restore it when you have finished with the mod_perl installation. In that case, type the following command first:
cpan> o conf makepl_arg
and copy its value somewhere before unsetting the variable.
List all the parameters as if you were passing them to the familiar perl Makefile.PL. If you add the APACHE_SRC=/home/stas/src/apache_1.3.xx/src and DO_HTTPD=1 parameters, you will not be asked a single question.
Now proceed with install mod_perl as before. When the installation is complete, remember to reset the makepl_arg variable by executing:
cpan> o conf makepl_arg ''
Note that if there was a previous value, use that instead of ''. You can now install all the modules you want to use with mod_perl. You can install them all at once with a single command:
cpan> install Bundle::Apache
This will install mod_perl if hasn't already been installed. It will also install many other packages, such as ExtUtils::Embed, MIME::Base64, URI::URL, Digest::MD5, Net::FTP, LWP, HTML::TreeBuilder, CGI, Devel::Symdump, Apache::DB, Tie::IxHash, Data::Dumper, and so on.
Copyright © 2003 O'Reilly & Associates. All rights reserved.