Subject: | $SIG{__DIE__} for unlink the $pidfile with childs |
i have a daemon with childs. currently i overwrite the $SIG{__DIE__} =
'DEFAULT' for every child, but i think this should do the App::Daemon
somethin like that perhaps:
my $master_pid = $$;
$SIG{__DIE__} = sub {
# Make sure it's not an eval{} triggering the handler.
if(defined $^S && $^S==0 && $master_pid == $$) {
unlink $pidfile or warn "Cannot remove $pidfile";
}
};