ELISHEVA: I think you have made a mistake. exec() on it's own will replace the currently running perl process with the new program, so a sucessfull call to exec will never return.
Perhaps you are thinking of a fork/exec or one of the many inter process comumnication methods described in perlipc.
To answer the original question, it depened on what shayak means by 'stops responding' Assuming that he can deduce that, then I would say the simplest method would be to start the process with open or fork/exec eg:
my $child_pid = open $handle, '-|', '/path/to/program' or die "Error s
+tarting program $!";
# Some time later the program stops responding
kill($child_pid);
or:
my $child_pid = fork();
if( 0 == $child_pid )
{
# Child
exec '/path/to/program';
die "error starting program $!";
}
# Some time later the program stops responding
kill($child_pid);
|