apache2 with autoindex and directory index, solved but it was hard .
Sérgio Basto <[email protected]> Sat, 15 Jun 2013 01:26:30 +0100
| Newsgroups | gmane.comp.web.mason.user |
|---|---|
| Message-ID | <1371255990.22144.16.camel@segulix> |
Hi, Mason people
I lost one night and of other day to discover the problem because your
quick and dirty example in
http://www.masonhq.com/htmlmason/wiki/HandlingDirectoriesWithDhandlers
just works if you define perl-script
$r->handler eq 'perl-script'
and not when define modperl
so please update wiki with attach and provide a full example that works
(please)
PerlRequire /etc/apache2/fixup_handler.pl
<VirtualHost *:80>
CustomLog "logs/mason-access.log" combined
ErrorLog "logs/mason-error.log"
PerlModule Apache2::Request
DefaultType text/html
PerlSetVar MasonDataDir "/var/cache/mason"
PerlSetVar MasonErrorMode fatal
PerlSetVar MasonArgsMethod mod_perl
PerlSetVar MasonDeclineDirs 0
SetHandler modperl
PerlHandler HTML::Mason::ApacheHandler
PerlFixupHandler Apache2::DirectoryFixup
DirectoryIndex index.html
</VirtualHost>
Thanks,
--
Sérgio M. B.
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Mason-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mason-users
fixup_handler.pl
(application/x-perl, 480 B)
package Apache2::DirectoryFixup;
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' || $r->handler eq 'modperl') &&
-d $r->filename &&
$r->is_initial_req) {
$r->handler(Apache2::Const::DIR_MAGIC_TYPE);
return Apache2::Const::OK;
}
return Apache2::Const::DECLINED;
}
1;