RE: any way to get the uri path part that matches $r->location?
Mark Hedges <[email protected]>
| Newsgroups | gmane.comp.apache.mod-perl |
|---|---|
| Message-ID | <55EEF0B3C5BF2744B2248754D717EE4C4B342F@USASHEXMB02.LYV.LiveNation.com> |
I was thinking about this, I think I can do something like:
my $loc = $r->location;
$loc =~ s{/$}{};
my ($loc_match, $rest_of_path) = $r->uri =~ m{^(\Q$loc\E.*?/)(.*?)$}mxs;
I will try it out when I get a chance.
Mark
-----Original Message-----
From: Mark Hedges
Sent: Monday, June 23, 2014 12:42 AM
To: mod_perl list
Cc: Mark Hedges
Subject: any way to get the uri path part that matches $r->location?
In Apache2::Controller the dispatch mechanism gets the URI into a variable, then removes $r->location from the start of it to get the remaining parts of the path, to determine which controller method to invoke.
This works for <Location> conf but not <LocationMatch>, because $r->location reports the string from the config block instead of the part of the path that matched it. If that is a weird pattern, then it is not found in the literal URI.
Is there a way to get at what part of the URI matched the <Location> or <LocationMatch> directive?
Thanks.
Mark