On Thu 15 Jan 2009, Foo JH wrote:
> Is there a generic method so that given any uri as a parameter, the
> library can do the math and return the physical path?
If you look for the filename for $r->uri, that means the uri of the
current request then $r->filename holds that after the map-to-storage
phase.
If you need a general method to map an arbitrary URI to a filename then
it is a subrequest:
my $subr=$r->lookup_uri($uri);
if( $subr->status == Apache2::Const::OK and
-f $subr->filename ) {
$filename=$subr->filename;
}
But keep in mind that it may result in quite unusual filenames if you
use the mod_proxy handler for example. Also, the file may not exist.
The status 404 is generated only in the response phase. Further, you
must perhaps check $subr->path_info for being empty.
Torsten
--
Need professional mod_perl support?
Just hire me: [email protected]