the TypeHandler phase will override your changes, I think. try setting
$r->handler with a PerlTypeHandler, apache stops after the first one
returns OK, so mod_mime won't stomp your $r->handler settings in that
case.
On Thu, 25 Nov 1999, Trevor Phillips wrote:
> I'm trying to write an access routine which requires altering the handler if
> certain conditions are (not) met. There are a few interesting examples of this
> in the "Apache Modules in Perl & C" book, chapter 7, which do something similar
> within the TransHandler and some other phases, but I'm trying to do it in the
> AccessHandler phase.
>
> Here's a simple test module:
>
> package Access;
>
> use Apache::Constants qw(:common);
>
> sub handler
> {
> my $r = shift;
> if ( -- some condition test -- )
> {
> $r->handler("perl-script");
> $r->set_handlers(PerlHandler=>[\&SomeRoutine]);
> return OK;
> }
> return DECLINED;
> }
>
> sub SomeRoutine
> {
> my $r = shift;
>
> $r->content_type('text/html');
> $r->send_http_header;
>
> print "Some content...";
> return OK;
> }
>
> So, basically, if a condition is met, then I return Access as OK, but I also
> override whatever handler is there with a custom one.
>
> The problem is, I cannot get this to work!! If a URI's handler is already
> perl-script, then SomeRoutine is called, but it is NOT overriding other
> handlers.
>
> If I use this module as a TransHandler, then it DOES work correctly, but I
> really need this to come in at the Access phase (as that's what it relates to).
>
> Any ideas?
>
> --
> . Trevor Phillips - http://jurai.murdoch.edu.au/ .
> : CWIS Technical Officer - [EMAIL PROTECTED] :
> | IT Services - Murdoch University |
> >------------------- Member of the #SAS# & #CFC# --------------------<
> | On nights such as this, evil deeds are done. And good deeds, of /
> | course. But mostly evil, on the whole. /
> \ -- (Terry Pratchett, Wyrd Sisters) /
>