Subject: | Net::Ping croaks when a name cannot be resolved |
Date: | Tue, 20 Mar 2018 09:38:48 +0000 |
To: | "bug-Net-Ping [...] rt.cpan.org" <bug-Net-Ping [...] rt.cpan.org> |
From: | "Dave Stafford [Globis]" <dstafford [...] mhg.co.za> |
I've just upgraded from Perl 5.20 to 5.24 on a Windows server and a lot of scripts that use Net::Ping have been broken because it now croaks when host resolution fails.
Previously with perl 5.20 Net::Ping was version 2.43, and when lookup failed it returned undef:
377: $ip = inet_aton($host);
378: return () unless defined($ip); # Does host exist?
Now in version 2.66 if the name lookup fails in the new _resolv routine it croaks, breaking all existing scripts, and contradicting the documentation which states it will return undef if lookup fails :
1878: croak(sprintf("getaddrinfo($h{host},,%s) failed - $err",
1879: $family == AF_INET ? "AF_INET" : "AF_INET6"));
Note that earlier in this routine there is the line:
1830 # numeric address, return
1831 my ($err, @getaddr) = Socket::getaddrinfo($h{host}, undef, \%hints);
But even though this (in my case) returns an error message for host not found, it continues down to the later code that croaks
Cheers,
Dave
**********************************************************************************************************************
---------
NOTICE
---------
This message (including attachments) contains privileged and confidential information intended only for the person or entity to which it is addressed.
Any review, retransmission, dissemination, copy or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient, is prohibited.
If you received this message in error, please notify the sender immediately by e-mail, facsimile or telephone and thereafter delete the material from any computer.
Metropolitan Health, its subsidiaries or associates, does not accept liability for any personal views expressed in this message.
Metropolitan Health
PO Box 4313 Cape Town 8000 Tel: 021 480 4511 Fax: 021 480 4535 www.mhg.co.za
**********************************************************************************************************************