Hi,
I have just stumbled on the following behavior.
httpd.conf:
<Perl>
{
package My::Object;
sub handler : method {
my ($self, $r)=...@_;
$r->push_handlers(PerlLogHandler =>
sub {
$self->doit;
});
}
sub DESTROY {...}
}
$My::XX=My::Object->new(...);
</Perl>
<Location /handler>
PerlResponseHandler $My::XX->handler
...
</Location>
<Location /quit>
PerlResponseHandler "sub {undef $My::XX; $_[0]->child_terminate; 0;}"
...
</Location>
If /quit is called the $My::XX object is undefined. So the one and only
reference to the global object is released and it has to be destroyed.
That works but only if /handler hasn't been called before.
The reason can be found in modperl_handler.c. Each time /handler is
called a new closure is stored in $PL_modglobal{ANONSUB}{$id}.
Unfortunately the closure is never deleted from the hash I believe. So
since $self is in the pad each time /handler is called a reference is
added to $My::XX from the closure.
I think that analysis is correct (not very sure) but I don't really know
how to fix it.
Any hints, ideas?
Torsten
--
Need professional mod_perl support?
Just hire me: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]