Hi, why do we not call perl's cleanup at child exit?
Here my setup: <Perl> package My::Test; use strict; use warnings; sub new { my (undef, $data)=...@_; my $inst=bless \$data; warn "$$: a new instance is born: $inst ($$inst)\n"; $inst; } sub DESTROY {warn "$$: DESTROY $_[0] (${$_[0]})\n"} $My::PInstance=My::Test->new('parent'); </Perl> PerlChildInitHandler "sub {$My::CInstance=My::Test->new('child')}" The destructor is called only once for $My::PInstance at server shutdown. This may be questionably right because if the object is created in the parent process so it is destroyed there and only there. But the $My::CInstance destructor is never called. Of course I can add a PerlChildExitHandler PerlChildExitHandler \ "sub {undef $_ for($My::PInstance, $My::CInstance)}" or an END block <Perl> END {undef $_ for($My::PInstance, $My::CInstance)} </Perl> Both are called at child shutdown. But that is a bit counter-intuitive since: perl -e '{ package My::Test; use strict; use warnings; sub new { my (undef, $data)=...@_; my $inst=bless \$data; warn "$$: a new instance is born: $inst ($$inst)\n"; $inst; } sub DESTROY { warn "$$: DESTROY $_[0] (${$_[0]})\n"; } } $My::PInstance=My::Test->new("parent");fork;' 8982: a new instance is born: My::Test=SCALAR(0x7c79b8) (parent) 8982: DESTROY My::Test=SCALAR(0x7c79b8) (parent) 8983: DESTROY My::Test=SCALAR(0x7c79b8) (parent) And then we have $r->child_terminate which simply calls exit() at C-level in a request pool cleanup. So, no perl-level cleanup at all is done. Do you think this is the right behavior? If not, what do you think would be correct? Torsten -- Need professional mod_perl support? Just hire me: torsten.foert...@gmx.net --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@perl.apache.org For additional commands, e-mail: dev-h...@perl.apache.org