One answer to your question would be relevant if you were running your script on a UNIX (or UNIX-like) box, trying to connect to WinNT machines, rather than on a WinNT machine itself.
On a UNIX-like machine you could set up a SIGALRM handler in your perl script and use alarm() to set the timer. To paraphrase perlfunc:alarm:
eval { local $SIG{ALRM} = sub { die "alarm\n"; } alarm 10 # here you call your get_sp() subroutine $servicpack = get_sp($computer); alarm 0; }; if ($@) { die unless $@ eq "alarm"; # propagate uexpected errors # timed out } else { # worked }
AFAIK, Perl's signal handling is iffy at best on WinNT machines (at least with ActiveState's port), so you may have to come up with another approach if your script is running on one of those. (I'd try it anyway :)
dmm
You can give a man a fish and feed him for a day ...In reply to Re: Dealing with timeouts using the Shell module
by dmmiller2k
in thread Dealing with timeouts using the Shell module
by thunders
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |