|
|
| Perl-Sensitive Sunglasses | |
| PerlMonks |
Re: is there script to detect if remote machine is alive/reachable w/o using Net::Ping?by grinder (Bishop) |
| on Jun 07, 2002 at 10:32 UTC ( #172478=note: print w/ replies, xml ) | Need Help?? |
|
odd you should say that. I use almost exactly the same code and I have never been troubled with lengthy delays. Are you sure you don't have a problem with DNS name resolution (even though your example shows the use of numeric IP addresses)? Here is the code I use. It is part of a CGI script, so there is a $q CGI object hanging around, and a few constant values for pretty colors, such as use constant PAINT_OK => '#008000' and so on.
The only other thing I could suggest would be to set an alarm of a second or two, an alarm handler and eval the code, in order to forcibly cancel the code. But if it's blocking at a low enough level, alarm won't necessarily work either, I've had that happen in the past. print@_{sort keys %_},$/if%_=split//,'= & *a?b:e\f/h^h!j+n,o@o;r$s-t%t#u'
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||