...unless i manually kill (Ctrl+Alt+Del) ...
Are you on Windows? If so, run your external program with Win32::Job, which has timeout support built in.
use Win32::Job;
my $job = Win32::Job->new;
# Run 'perl Makefile.PL' for 10 seconds
$job->spawn($Config{perlpath}, "perl Makefile.PL");
$job->run(10);
-xdg
Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.