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).
panic% perl -MCPAN -eshell
You will see the cpan prompt:
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.
If you have a system that's already configured with all the Perl modules you use, making your own bundle is a way to replicate them on another system without worrying about binary incompatibilities. To accomplish this, the command autobundle can be used on the CPAN shell command line. This command writes a bundle definition file for all modules that are installed for the currently running Perl interpreter.
With the clever bundle file you can then simply say:cpan> install Bundle::my_bundle
and, after answering a few questions, go out for a coffee.
mod_perl, modperl, Apache, perl, cgi, html, mod_perl, e-commerce, scalability, free, open source, OSS, apache, squid, high availability, modperl, linux, unix, Web, www, mod_perl, webserver, admin, apache, book, webmaster, tools, modperl, guide, docs, documentation, help, mod_perl, perl, information, apache, script, errata, eric cholet, perl, apache, mod-perl, stas bekman, mod_perl, cool, perl, Apache, performance, speed, choice
Other projects to check out: meta-religion.com is for those interested in Religious, Spiritual and Esoteric Phenomena. i-want-a-better.com is a community of people discussing what they would like to be improved in their lives and things they use and interact with. You may also want to find a healer in your area or read articles on variety of topics.