Comment 3 for bug 1831423

Revision history for this message
Martin Deppe (martin-deppe) wrote :

Thanks for the patch, I tried it and suggest the following instead (removing the "_" and everything beyond in the Version string) so that it actually keeps its behaviour for versions prior to 1.94 and in addition to that I encountered a third location where $Socket::VERSION is being used inside that file:

--- Ping.pm.orig 2016-10-27 14:12:58.000000000 +0200
+++ Ping.pm 2019-11-14 13:45:56.886072962 +0100
@@ -1798,7 +1798,9 @@

   # address check
   # new way
- if ($Socket::VERSION >= 1.94) {
+ my $socketVersion = $Socket::VERSION;
+ $socketVersion = $1 if $socketVersion =~ /(\d\.\d+)_\d+/;
+ if ($socketVersion >= 1.94) {
     my %hints = (
       family => $AF_UNSPEC,
       protocol => IPPROTO_TCP,
@@ -1831,7 +1833,7 @@

   # resolve
   # new way
- if ($Socket::VERSION >= 1.94) {
+ if ($socketVersion >= 1.94) {
     my %hints = (
       family => $family,
       protocol => IPPROTO_TCP
@@ -1908,7 +1910,9 @@
       ) = @_;

   my $ret;
- if ($Socket::VERSION >= 1.94) {
+ my $socketVersion = $Socket::VERSION;
+ $socketVersion = $1 if $socketVersion =~ /(\d\.\d+)_\d+/;
+ if ($socketVersion >= 1.94) {
     my ($err, $address) = Socket::getnameinfo($addr, $NI_NUMERICHOST);
     if (defined($address)) {
       $ret = $address;