Mod perl

From CunningPlans

Jump to: navigation, search

Baldrick may be run with Apache mod_perl.

When run with mod_perl, Baldrick::Stub is not used. Instead, the entry point is the Baldrick::Trousers module, so named because it has a long lifespan - much like the historical Baldrick's trousers, which were changed far too infrequently.

Use the following configuration section in Apache httpd.conf or httpd-vhosts.conf to set up Baldrick as the handler for a path:

 <Perl>
   # Point to the directory that contains the "Baldrick" lib directory.
   use lib '/var/www/mystie/cgi-bin/lib';
 </Perl>
 #
 <Location /bin/>
   SetHandler perl-script
   #
   # These environmental variables are used by Baldrick to locate config files,
   # templates, etc.  Baldrick will chdir() to the BALDRICK_WORKDIR on startup, 
   # if it is defined.
   PerlSetEnv BALDRICK_WORKDIR /var/www/mysite/cgi-bin
   PerlSetEnv BALDRICK_CONFIG_PATH /var/www/mysite/cgi-bin/etc
   PerlSetEnv BALDRICK_CONFIG_FILE baldrick.cfg
   #
   # This defines the class to invoke for handling each request.
   PerlResponseHandler Baldrick::Trousers
   #
   Options +ExecCGI
   PerlSendHeader On
   Allow from all
 </Location>

The Apache handler Baldrick::Trousers will maintain a Baldrick::App object and use it to service multiple requests. Baldrick::App, if successful in loading its configuration file using the environmental variables provided, will use the PathMap section in the config file to dispatch requests to handlers, as usual.

For mod_perl installations, Baldrick::Stub is not needed - nothing at all must exist at the physical location that corresponds to the URL, if explicit config and template paths point to locations elsewhere.

Personal tools