On May 24, 2004, at 12:55 PM, Geoffrey Young wrote:
<%init>;
use Apache::Constants qw(DIR_MAGIC_TYPE);
$m->abort(-1) if $r->content_type eq DIR_MAGIC_TYPE && $r->uri !~ m{/$};
</%init>
-1 is DECLINED, right?
For Mason it is, at any rate. If it's the same as DECLINED, I'll use that, instead.
sub fixup_handler { my $r = shift; $r->handler('perl_script') # or $r->handler('modperl') unless $r->content_type eq DIR_MAGIC_TYPE && $r->uri =~ m{/$};
I think that 'unless' should be 'if' - if the request is for a directory,
and if the directory has a trailing slash, set the content handler to be
perl-script. I think the above logic demorgans out to
if ( ! $r->content_type eq DIR_MAGIC_TYPE || $uri !~ m{/$} )
which isn't quite right. sorry if that is what I wrote before.
Don't think so, it's my fault for not thinking it through (I'm so used to telling mod_perl _not_ to handle something! I'll change it to this:
sub fixup_handler { my $r = shift; $r->handler('perl_script') # or $r->handler('modperl') if $r->content_type ne DIR_MAGIC_TYPE || $r->uri =~ m{/$}; return DECLINED; }
return DECLINED; }
returning OK from a fixup handler is probably more idiomatic.
Oh, so that doesn't prevent any others from running? In that case, I'll change it to this:
sub fixup_handler { my $r = shift; $r->handler('perl_script') # or $r->handler('modperl') if $r->content_type ne DIR_MAGIC_TYPE || $r->uri =~ m{/$}; return OK; }
So none of the above solutions should be necessary in mod_perl 2, but as of
this writing, I don't know how things work with Mason in mod_perl 2.
I think it's clear that you can't handle directories in mason with mod_perl
2 until a fixup handler like that is installed - mp2 simply doesn't enter
into requests for directories at the moment (or so it would seem).
Okay, great, thanks a million!
Regards,
David
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]