Any way for a PerlHandler to know what Location block it's in?
Confusing subject, simple question: Location /foo/bar PerlSetVar MyRoot /foo/bar SetHandler perl-script PerlHandler MyModule /Location MyModule calls $r-dir_config('MyRoot') to get the /foo/bar path. I want to ditch the PerlSetVar MyRoot line because it will always have the same value as the Location directiv above it. Is there a way MyModule can get /foo/bar using some other means? (This is mod_perl 1, BTW) -John
Re: Any way for a PerlHandler to know what Location block it's in?
John Siracusa wrote: Confusing subject, simple question: Location /foo/bar PerlSetVar MyRoot /foo/bar SetHandler perl-script PerlHandler MyModule /Location MyModule calls $r-dir_config('MyRoot') to get the /foo/bar path. I want to ditch the PerlSetVar MyRoot line because it will always have the same value as the Location directiv above it. Is there a way MyModule can get /foo/bar using some other means? I feel almost silly saying this, but did you look at $r-location? http://perl.apache.org/docs/1.0/api/Apache.html#_r_E_gt_location -- Michael Peters Developer Plus Three, LP
Re: Any way for a PerlHandler to know what Location block it's in?
On 6/8/05, Geoffrey Young [EMAIL PROTECTED] wrote: $r-location() ? Duh, I'm an idiot. Thanks :) -John
Re: Any way for a PerlHandler to know what Location block it's in?
On Wed, Jun 08, 2005 at 12:00:23PM -0400, John Siracusa wrote: On 6/8/05, Geoffrey Young [EMAIL PROTECTED] wrote: $r-location() ? Duh, I'm an idiot. Thanks :) -John $r-location will also return whatever's in a LocationMatch, Directory and DirectoryMatch directive, should the scope of the request lay in one of those. if you're simply clipping the location off the front of the request uri you could potentially run into trouble. you can always piggyback the Location directive specifically, using the configuration api and use what you get back from that. .d
Re: Any way for a PerlHandler to know what Location block it's in?
On 6/8/05, Dorian Taylor [EMAIL PROTECTED] wrote: $r-location will also return whatever's in a LocationMatch, Directory and DirectoryMatch directive, should the scope of the request lay in one of those. if you're simply clipping the location off the front of the request uri you could potentially run into trouble. you can always piggyback the Location directive specifically, using the configuration api and use what you get back from that. Thanks. I realize that, but I only need it to work specifically for plain old Location blocks. I have sanity checks to make sure it really is a prefix of the requested URI since I am indeed clipping it off the URI. None of these paths have any representation in the file system, so path_info is no help. I thought about wandering the apache config using perl's interface to that info but it seemed like too much trouble. Is there a better way to get the rest of the URI? -John