You could use an END block that kills the children. See perlmod for documentation for END blocks.
I sketched out a somewhat complicated technique in Re: Keeping children alive persistiently, intelligently Basically, each child process is governed by an object that will kill it when the object is destroyed.
Both of those have a problem in that the parent doesn't get a chance to kill its children if it receives a KILL signal (9) rather than the usual TERM (15).
A similar question was asked in Child process dies. That thread gives suggestions for how to deal with when the parent gets a signal it can't trap.
|