>>SetHandler is forcing the handler to be mod_perl, but really mod_dir needs
>>to step in and handle the / -> DirectoryIndex conversion. so... what I would
>>do is alter that fixup handler to do something like this
>>
>> if ($r->handler('perl-script') && -d $r->filename && $r->is_initial_req) {
>> $r->hander(Apache2::Const::DIR_MAGIC_TYPE);
>> }
>>
>>or somesuch. basically, what you want to happen is for mod_dir to apply the
>>directory index and issue it's normal internal_direct to mod_perl. un-doing
>>mod_mime's SetHandler for just the main request ought to do that.
that code is essentially right. well, except that the above example sets
$r->handler instead of comparing it. adding the code at the bottom of this
mail essentially makes your tests pass, except that I think your last test
is wrong - your DirectoryIndex puts the index script ahead of everything
else, so the results should match "Hello" and not "welcome".
> I tried adding the above code to Apache::Dir
Apache::Dir was just an example. the below code used as the only fixup
handler should do the trick.
HTH
--Geoff
package My::Fixup;
use strict;
use warnings FATAL => qw(all);
use Apache2::Const -compile => qw(DIR_MAGIC_TYPE OK DECLINED);
use Apache2::RequestRec;
sub handler {
my $r = shift;
if ($r->handler eq 'perl-script' &&
-d $r->filename &&
$r->is_initial_req)
{
$r->handler(Apache2::Const::DIR_MAGIC_TYPE);
return Apache2::Const::OK;
}
return Apache2::Const::DECLINED;
}
1;