On Fri, 10 Oct 2008, Karl Rune Nilsen via RT wrote:
Show quoted text> When an eval dies in a require/BEGIN, $^S is set to undef, and
> App::Daemon deletes the pidfile. If you change the test to "defined
> $^S and $^S==0", the pidfile will not be deleted in this case.
Thanks for the more detailed description. I've tried to reproduce it,
but interestingly I can't get it to trigger the handler as you've
described. Here's my test module:
package MyTest;
eval {
die "Whoa!";
};
1;
and here's my test program:
require MyTest;
$SIG{__DIE__} = sub {
if(! $^S) {
print "Die handler\n";
}
};
print "Done.\n";
which just shows "Done." when I run the program, with both perl-5.8
and perl-5.10. Are you doing anything differently?
Show quoted text> There might be better ways to do this test in App::Daemon. Maybe with an
> END block or an AtExit, I'm not sure.
The END block doesn't kick in if the process is killed with a signal like
SIGINT, so I'd prefer the __DIE__ handler if we can find a test for $^S that
works in all scenarios.
-- Mike
Mike Schilli
m@perlmeister.com