http://qs321.pair.com?node_id=588918


in reply to How to get the value of <Location> directive (mod_perl)?

I'm not sure this is what you're after, but it seems like it might be a problem I had recently: if your module is handling all of the requests below a certain root URI, and you're taking actions based on the path after that root, how do you know (without hardcoding it or some other such evil tactic) how much of the uri is what you're supposed to be processing?

My solution, which may or may not have been a good one, was to do the Apache configuration in Perl. The root URL for each handler is set in a constants file, and the configuration section refers to that constant when setting up the server. (I can't remember precisely the syntax, but it's roughly $Location{$MY::ROOT_URL} = { PerlResponseHandler=>'My::Apache::Handler', SetHandler=>"perl-script'};) Then the handler itself refers to that same constant when determining its root path: (my $path = $r->uri) =~ s/^\Q$MY::ROOT_URL//;.

If that wasn't the problem you were trying to solve, my apologies, but it seemed like a decent shot. :-)



If God had meant us to fly, he would *never* have given us the railroads.
    --Michael Flanders