Chapter 15. Web Server Programming with mod_perlContents:
Installing mod_perl mod_perl is an Apache module that embeds the Perl interpreter directly into Apache. There are many advantages to mod_perl:
mod_perl isn't for everyone. By embedding Perl directly into the Apache httpd executable, mod_perl invokes significant overhead of its own. If you only have static documents, you certainly wouldn't use a mod_perl-enabled version of Apache to serve them. However, if you have a lot of dynamic content, you'll find mod_perl to be extremely powerful. You can also have the best of both worlds by designing your web site to serve static documents off a "normal" Apache server and dynamic documents off a mod_perl server. At this writing, the release of mod_perl 2.0 is imminent, but mod_perl 1.3 is considered the stable version. mod_perl 2.0 is a near-complete rewrite that takes advantage of the threading features in Apache 2.0 and Perl 5.8. However, mod_perl 2.0 is still considered experimental. As the migration period to mod_perl 2.0 is expected to be long, this chapter covers mod_perl 1.3. 15.1. Installing mod_perlIf you already have Apache installed on your machine, you will have to rebuild it with mod_perl. You can get the source and documentation for mod_perl from http://perl.apache.org/. If there isn't already an Apache httpd in the Apache source tree, you must build one. Then build mod_perl as directed in the INSTALL file for the mod_perl distribution. As we've mentioned, mod_perl allows you to hook in Perl modules as handlers for various stages of a request. By default, however, the only callback hook that is enabled is PerlHandler, which is the one that processes content (i.e., a CGI document). If you want to use other hooks—for example, to extend Apache's logging facilities via the PerlLogHandler directive; you need to specify it at build time as directed in the INSTALL file. For example: % perl Makefile.PL PERL_LOG=1 The mod_perl Makefile replaces the httpd in the Apache source tree with a Perl-enabled one. When you install mod_perl, it installs not only the new httpd in your system area, but also several Perl modules, including Apache::Registry. Copyright © 2003 O'Reilly & Associates. All rights reserved. |
|