> -----Original Message-----
> From: Doug MacEachern [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, August 15, 2000 11:22 PM
> To: Geoffrey Young
> Cc: '[EMAIL PROTECTED]'
> Subject: Re: $r->get_handlers bug/oversight?
>
>
> On Tue, 25 Apr 2000, Geoffrey Young wrote:
>
> > Hi all...
> >
> > I've noticed that get_handlers() will return the
> enabled handlers
> > for a PerlPostReadRequestHandler, but not when it is specified as a
> > PerlInitHandler (either by calling
> > $r->get_handlers('PerlPostReadRequestHandler') or
> > $r->get_handlers('PerlInitHandler'). It is the same with
> > PerlHeaderParserHandler. An oversight?
>
> PerlInitHandler is just an alias for PerlPostReadRequestHandler and
> PerlHeaderParserHandler. mod_perl can only know at config-time if
> InitHandler should be alias to PostReadRequest or
> HeaderParser, i don't
> think get_handlers() can figure out which you mean at request time.
ack... so the alias only goes one way? I guess it makes sense that we
can't know at run time what the Init handler stands for, but how come
get_handlers('PerlInitHandler') comes up blank? Isn't it just a table
entry?
>
> > Also, I can't get anything for PerlCleanupHandlers, which kinda
> > makes sense, since Cleanup isn't really a phase, per se (at
> least according
> > to the book). Does it make sense to add this to
> get_handlers() as well?
>
> the get_handlers() patch posted earlier should enable get/set of
> PerlCleanupHandlers.
well, it got the handler ok, but I couldn't set it properly:
#!/usr/bin/perl
my $r = shift;
$r->set_handlers(PerlCleanupHandler => [\&cleanup]);
$r->send_http_header('text/plain');
print "done";
sub cleanup {
warn "hi";
}
is a no go. same with using ['My::Cleanup'] as the arg...
I also noticed that the patch didn't fix the get_handlers() coderef bug:
#!/usr/bin/perl
my $r = shift;
$r->push_handlers(PerlCleanupHandler => sub { warn "hi"; });
#my $handlers = $r->get_handlers('PerlCleanupHandler');
$r->send_http_header('text/plain');
print "done";
uncomment the get_handlers() line and the cleanup handler never runs and you
get "Attempt to free unreferenced scalar"
if you have some tuits :)
--Geoff
>