Using mod_perl2, is there a way of mapping a URI to a filename or
directory.
I can get the root directory for the server and I can append the URI to
it but this doesn't taking to account aliases, UserDir directives etc..
Any suggestions?
Anthony.
Printable View
Using mod_perl2, is there a way of mapping a URI to a filename or
directory.
I can get the root directory for the server and I can append the URI to
it but this doesn't taking to account aliases, UserDir directives etc..
Any suggestions?
Anthony.
Anthony R Fletcher wrote:[color=blue]
> Using mod_perl2, is there a way of mapping a URI to a filename or
> directory.
>
> I can get the root directory for the server and I can append the URI to
> it but this doesn't taking to account aliases, UserDir directives etc..
>
> Any suggestions?[/color]
$r->filename()
[url]http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html#C_filename_[/url]
--Geoff
Thanks but that only works for the current request. I was looking for a
way of translating some other URI to a pathname on the same server.
Anthony
On 18 Aug 2008 at 15:26:53, Geoffrey Young wrote:[color=blue]
>
>
> Anthony R Fletcher wrote:[color=green]
> > Using mod_perl2, is there a way of mapping a URI to a filename or
> > directory.
> >
> > I can get the root directory for the server and I can append the URI to
> > it but this doesn't taking to account aliases, UserDir directives etc..
> >
> > Any suggestions?[/color]
>
> $r->filename()
>
> [url]http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html#C_filename_[/url]
>
> --Geoff[/color]
--
Anthony R Fletcher
Room 2033, Building 12A, [url]http://dcb.cit.nih.gov/~arif[/url]
National Institutes of Health, [email]arif@mail.nih.gov[/email]
12A South Drive, Bethesda, Phone: (+1) 301 402 1741.
MD 20892-5624, USA.
Anthony R Fletcher wrote:[color=blue]
> Thanks but that only works for the current request. I was looking for a
> way of translating some other URI to a pathname on the same server.[/color]
$r->lookup_uri('/some/uri')->filename()
[url]http://perl.apache.org/docs/2.0/api/Apache2/SubRequest.html#C_lookup_uri_[/url]
--Geoff
Perfect. Thank you.
Anthony
On 19 Aug 2008 at 09:53:03, Geoffrey Young wrote:[color=blue]
>
>
> Anthony R Fletcher wrote:[color=green]
> > Thanks but that only works for the current request. I was looking for a
> > way of translating some other URI to a pathname on the same server.[/color]
>
> $r->lookup_uri('/some/uri')->filename()
>
> [url]http://perl.apache.org/docs/2.0/api/Apache2/SubRequest.html#C_lookup_uri_[/url]
>
> --Geoff[/color]
--
Anthony R Fletcher
Room 2033, Building 12A, [url]http://dcb.cit.nih.gov/~arif[/url]
National Institutes of Health, [email]arif@mail.nih.gov[/email]
12A South Drive, Bethesda, Phone: (+1) 301 402 1741.
MD 20892-5624, USA.