<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<title>Using Cricket with mod_perl </title>
<h1>Using Cricket with mod_perl</h1>
<tt>mod_perl</tt> is an Apache module that allows you to run
Perl scripts inside of Apache without forking a new process for
each one. This saves lots of time, since Perl only needs to
parse the script once and can execute it a number of times.
As of version 0.68, Cricket can run under <tt>mod_perl</tt>.
Typically, no special code needs to be added to scripts to make
them work in the mod_perl environment, but Cricket's lazy use of
namespaces required some fix up work. Mea culpa. That work has
been done now, and going forward, I intend to make sure Cricket
works under mod_perl.
If you'd like to use Cricket under mod_perl, you need to first
fetch and install Apache with the mod_perl module. Cricket has
only been tested so far with Apache 1.3.6 and mod_perl 1.19. The
best way to build and install Apache and mod_perl is to fetch
both packages, uncompress and untar them into one directory,
then go into the mod_perl directory first and follow the
directions in the <tt>INSTALL.apaci</tt> file.
Once you have an installation of Apache with mod_perl installed,
you need to add lines like the following to your httpd.conf file:
These lines tell your webserver that whenever it sees a file
ending in .cgi, it should let the embedded Perl interpreter run
it. This, of course, is problematic if you have some .cgi files
on your webserver that cannot be run by Perl. In that case, you
should use a more restrictive specification than "*.cgi" to
limit the scope of the directives to files in the Cricket user's
There seems to be a bug which causes Apache to fail to find a
library file in some cases. Confusingly, this tends to happen
when it's trying to handle a URL that points to an image,
resulting in missing images. This is strange, since serving up
images should not require the Perl interpreter. You can fix this
by setting the <tt>PERL5LIB</tt> environment variable to the
Cricket library directory before starting the Apache webserver.
If you are going to be editing the library files (i.e. to add a
new feature), you'll want to definitely add the "PerlInitHandler
Apache::StatINC" directive to your config file. This will make
mod_perl check library timestamps and reload/reparse them when
necessary. You should not run a production server with this
enabled, since it does some extra work each time a library is
used, which could be avoided. If you are not using the StatINC
module, you will need to restart your server anytime you change
a library file, or else the changes will not be picked up.
version 1.0.5, released 2004-03-28.
Copyright (C) 1998-2000 Jeff Allen. Cricket is released under
the <a href="gpl.html">GNU General Public License</a>.