#!/usr/bin/perl use strict; use warnings; use Win32::Exe; $SIG{ALRM} = sub {die "timeout"}; eval{ alarm(1); Win32::Exe->new($ARGV[0]); alarm(0); }; if($@){ if($@ =~/timeout/){die "timeout detected"}; }else{ print "ok, can parse $ARGV[0]\n"; };