dreadpiratepeter has asked for the wisdom of the Perl Monks concerning the following question:

It seems this facility should be out there, but I couldn't find it. I have some virtual paths. I.e.: /media/schema/icons/foo.gif
The apache alias facility translates them properly:
    alias /media/schema/icons /filesystem/a/b/icons

The thing that I'm missing is this. In my perl code i have a virtual path, but i need to translate that to the actual path. I'd rather not have to maintain two sets of aliases. Is there a way to access the apache alias translations from within mod_perl handlers? something like $r->translate_alias($vstr)

Thanks in advance,
UPDATE: Duh! right at the beginning of the Apache man page. was so busy searching on aliases and such that i totally missed it. Thanks all.


-pete
"Worry is like a rocking chair. It gives you something to do, but it doesn't get you anywhere."
  • Comment on Getting at apache aliases from mod_perl handlers

Replies are listed 'Best First'.
Re: Getting at apache aliases from mod_perl handlers
by merlyn (Sage) on May 14, 2006 at 17:37 UTC
Re: Getting at apache aliases from mod_perl handlers
by ioannis (Abbot) on May 14, 2006 at 19:46 UTC
    Use $r->uri() to translate the uri, or $r->filename() if you want to map from uri to pathname. Then return DECLINED if you want other modules to participate in further translations.

    As merlyn suggested, you can use subrequests. This is only if you want to ensure that present changes do not result in errors and further uri changes are performed as originally planned.