No such thing as a small change | |
PerlMonks |
Net::Ping Problemsby Paulster2 (Priest) |
on Oct 21, 2003 at 23:16 UTC ( [id://301104]=perlquestion: print w/replies, xml ) | Need Help?? |
Paulster2 has asked for the wisdom of the Perl Monks concerning the following question: While trying to port code from our Enterprise server to one of our Blade workstations, I was working through changing directory pointers and so forth. One of the problems I encountered was a problem with Net::Ping, in that I kept getting an error saying “Can’t get tcp protocol by name” or “Can’t get udp protocol by name” depending on which method I was using. I was able ping on the command line to the destination, but still unable to make the code work. The portion of the code was easily tracked down to a part of the Net::Ping module that reads like this:
I was able to tweak this module a little bit, with pretty good results, as I was able to go back to the original code I was using with minimal porting. It now looks something like this:
By forcing the module to continue instead of “croak”ing, I was able to let it complete and get the comeback that it needed to succeed. I also changed (earlier in the module) the max timeout value. This is important because the code I am using has to go out and check over 125 workstations. If some of them are dead, the timeout multiplies fast. I was able to use Shell.pm and run it through the command line from within the program, but the time minimum timeout value allowed is one second, so the other day when all of our workstations were down due to an impending power outage, it took forever for that part of the code to run. Using Net::Ping seems to run much faster. My questions are these to anyone who might be a little bit more experienced than I: What, if anything, might this break if left this way, and why would this cause a problem in the first place? Since I am using 5.6.0, was this problem fixed with 5.8 (or newer)? Is this a know problem or am I just hosed (no I’m not from Canada)?
Any thoughts would be appreciated.
Back to
Seekers of Perl Wisdom
|
|