Philippe M. Chiasson wrote:

>> Is PerlInitHandler a hook too early for adding PerlResponseHandlers?
 
> Not too early, but the mapping / => index.phtml is done by mod_autoindex
> at a later phase, so when your InitHandler _could_ kick in, the request
> still has $r->filename point to the directory, FIlesMatch \.phtml$ _not_
> matching.
 
> You should try something like:
 
> <Directory /top/level/path/where/your/files/are>
>   PerlInitHandler Dispatcher
> </Directory>
 
> sub handler() {
> my $r = shift;
> return DECLINED unless $r->filename =~ /\.phtml$/;
> [...]
> }

That didn't work either, since it blocked mod_dir, but I've found a FixUp
handler suggestion from Geoff (I hope he doesn't mind I'm referring with
his signing name :))
http://www.issociate.de/board/post/199936/DirectoryIndex_ignored_when_using_perl-handler.html

combining your handler (with regex /(?:\.phtml|\/)$/ together with the FixUp
handler and
<Location /> #I want this for all my virtualhost's docroots
        PerlInitHandler Dispatcher
        PerlFixUpHandler FixUp 
</Location>

made things work exactly as I want. Only downside is that now, all my
DirectoryIndex'ed files go through my dispatcher, I presume that since the
Dispatcher is called from PerlInitHandler, $r->filename is still pointing
to / ?
--
kind regards,
Tim Esselens



Reply via email to