On Tue, 25 Apr 2000, Doug MacEachern wrote:
> > I guess the problem is that mod_mime implements SetHandler - and I'm not
> > convinced it should. If you were given the opportunity to do it all again
>
> understood, but this is how apache is designed, mod_perl is just going
> with the flow here.
>
> > I'd suggest it be done as follows:
> >
> > If a PerlTypeHandler returns OK, check if
> > @{$r->get_handlers('PerlHandler')} is true (i.e. there's a PerlHandler
> > waiting in the wings). If so, call $r->handler('perl-script').
>
> so why not just do that in your PerlTypeHandler?
I do now - just uploaded a new version. It's still not correct though - a
proper fix would have to pull SetHandler out of mod_mime altogether, I
guess. For example, say your config contains:
# PerlTypeHandler blah
SetHandler perl-script
PerlFixupHandler foo
And in foo::handler() you call $r->push_handler('perl-script'). Suddenly
it stops working when you uncomment the PerlTypeHandler there.
I guess one important question is - why do we have to call SetHandler for
PerlHandlers and not for any of the other handler phases. For all the
other phases Apache/mod_perl automatically figures out if there's a
handler installed and either runs perl code, or lets apache do its
work. Why can't PerlHandler do the same? (as you can tell - I haven't dug
into the internals of this - but I am curious).
> i don't think it's right
> for mod_perl to have that logic hardwired in. the other solution, is to
> let mod_mime do it's thang in the type phase, and do your thang in the
> fixup phase to override anything mod_mime did that you don't want.
Right. So what's the point of PerlTypeHandler again?... ;-) Seriously
though - Apache::MimeXML is the only PerlTypeHandler, as far as a quick
search reveals, apart from your examples in the book. So maybe it would be
worth investigating this further.
A fixup handler is an interesting solution... but can I stack
FixupHandlers? (I run most of my mod_perl code from a FixupHandler).
Also, you didn't pick up on something I sent to the list in another
thread... I have code that goes:
if ($r->current_callback eq 'PerlFixupHandler') {
$r->push_handlers('PerlHandler', \&code);
}
else {
&code($r);
}
so that I can install the module as either a fixup or a PerlHandler. The
fixup installed version is 4 times slower than calling the function
directly - is that to be expected? (we're talking 20 requests/sec vs 80
here - a huge difference).
--
<Matt/>
Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org http://xml.sergeant.org