NAME
Process::Child::Leash - to make sure the child process wont get lost with their parent.
DESCRIPTION
Here is the issue. The parent process is a bash script wrapping (parent ) around the real process. If we kill the wrapper script. The real process ( child ) is still remain.
+
|--run.sh
|
|-- perl script.pl
This module will keep an eye on the parent process. When the parent is gone. It will remove the kill the real process (child).
USAGE
ATTACH IT WITHIN THE CODE
#!/usr/bin/perl
use strict;
use warnings;
use Process::Child::Leash;
... start of the script ...
USE IT OUTSIDE THE CODE
perl -MProcess::Child::Leash script.pl
TIMEOUT THE HANGING PROCESS
Timeout after 10 seconds running.
CHILD_LEASH_TIMEOUT=10 perl -MProcess::Child::Leash script.pl