[sf-perl] mod_perl and DocumentRoot question

spidaman at arachna.com spidaman at arachna.com
Thu Mar 8 17:29:33 PST 2007

You mean, like in httpd.conf
<Location /batz>
  SetHandler perl-script
  PerlHandler Quinn::Batz

and in perl space:
package Quinn::Batz;
use strict; # duh
sub handler {
    my $r = shift;
    # do stuff with the Apache API

so that /batz is mapped to your perl module? The key here is that Apache 
can resolve virtual paths with <Location> containers, including running 
modperl handlers. 

On Thu, 8 Mar 2007, Quinn Weaver wrote:
> I'm almost embarrassed to be asking this, but I've forgotten the
> solution, and my old code belongs to someone else.  (Does this mean
> I've forgotten more mod_perl than most hackers know? ;) ) I've checked
> the mod_perl Cookbook and run some searches, but to no avail.
> The problem is that Apache expects me to have a path in my DocumentRoot
> for each URL I support.  For instance, if I have
> http://www.example.com/foo/bar/
> http://www.example.com/batz/
> Then it expects there to be directories
> /var/www/foo/bar
> /var/www/batz
> This is silly, because my PerlHandler is generating the content--it's not
> stored in static files on disk.  Moreover, I have dynamically generated URLs
> like http://www.example.com/user/quinn/edit .
> What is the solution to this dumb problem?  Somebody throw me a rope. ;)
> Thanks,

Ian Kallen <spidaman _at_ arachna _dot_ com> | Yahoo/AIM: iankallen

More information about the SanFrancisco-pm mailing list