Re: $r->location() question

[prev] [thread] [next] [Date index for 2005/05/25]

From: Stas Bekman
Subject: Re: $r->location() question
Date: 17:34 on 25 May 2005
Adam Prime x443 wrote:
> Assume i have a handler that sits in a location, and that handler has
> it's own admin interface built in.  I also want to be able to easily
> change the directory that the handler is running in, or have it running
> in multiple locations (so i don't want to hardcode the location into
> the script.
> 
> So my .conf looks like this.
> 
> <Location /crap> SetHandler perl-script PerlHandler Something::Crap 
> </Location>
> 
> <Location /crap/admin> AuthName "Something" AuthType Crap
> 
> PerlAuthenHandler Something::Authen PerlAuthzHandler Something::Authz 
> require valid-user </Location>
> 
> The only annoying thing about this is that $r->location will return
> '/crap/admin/' when i'm on the admin part of the site.  Is there any
> way to get the actual location that the PerlHandler is running in
> despite the fact i'm using Authen and Authz handlers in /crap/admin/?

/crap/admin/ *is* the actual location.

> Right now i just parse the /admin out of the location() myself, but
> that's kind of annoying.  I haven't tried resetting the location though
> (like $r->location($newlocation)) but i'm not sure if that will work
> offhand.
> 
> Is there a better way to do this kind of thing?

sure: write a fixup handler which will set $r->location to whatever you want:
http://perl.apache.org/docs/2.0/user/handlers/http.html#PerlFixupHandler


        -- 
        __________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@xxxxxx.xxx http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

$r->location() question
Adam Prime x443 16:53 on 25 May 2005

Re: $r->location() question
Stas Bekman 17:34 on 25 May 2005

Generated at 20:12 on 05 Jun 2005 by mariachi v0.52