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

If you don't want to use an 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
<Location '/cgi-perl/myindex'>
    SetHandler  perl-script
    PerlHandler My::Front

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