NATIONAL BUREAU OF ECONOMIC RESEARCH
NATIONAL BUREAU OF ECONOMIC RESEARCH

How to use a Perl::Module for slash (root) on a web server

If you don't want to use an index.pl file or something of the like to serve your dynamic front page, but instead want to use a perl module under mod_perl (modperl), it's rather difficult (for me at least) to figure out how to do this. Special thanks to Brian Moore <bem at CMC.NET> for the main part of the solution:

<Location '/'>
  DirectoryIndex /cgi-perl/myindex index.html index.htm index.shtml index.cgi index.pl
</Location>
   
<Location '/cgi-perl/myindex'>
    SetHandler  perl-script
    PerlHandler My::Front
</Location>

The two step solution is necessary to avoid having "/books/" be interpreted as the index page with path_info = '/books/' etc. This is what happens if you just use the SetHandler and PerlHandler lines alone.

You'll need the rest of the DirectoryIndex line to make ~user work

Myke Cuthbert (cuthbert at nber.org)

 
Publications
Activities
Meetings
Data
People
About

National Bureau of Economic Research, 1050 Massachusetts Ave., Cambridge, MA 02138; 617-868-3900; email: info@nber.org