FAQ
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

Search Discussions

  • Mark Hedges at Jun 23, 2014 at 10:38 pm
    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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupmodperl @
categoriesmodperl, perl
postedJun 23, '14 at 7:42a
activeJun 23, '14 at 10:38p
posts2
users1
websiteperl.apache.org

1 user in discussion

Mark Hedges: 2 posts

People

Translate

site design / logo © 2018 Grokbase