Skip Menu |

This queue is for tickets about the Net-SNMPTrapd CPAN distribution.

Report information
The Basics
Id: 119157
Status: resolved
Worked: 1.5 hours (90 min)
Priority: 0/
Queue: Net-SNMPTrapd

People
Owner: Nobody in particular
Requestors: jmaslak [...] antelope.net
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.17



Subject: Warning generated on Perl 5.24.0
Thanks for the module! In this module, in _inetNtoa(), you check the version of the Socket module with a numeric comparison. Unfortunately $Socket::VERSION in the version of Socket distributed as a core module with Perl 5.24.0 is "2.020_03", so when the comparison is done, Perl generates a warning that the VERSION variable is not numeric in a numeric comparison. In addition to the warning, it will fall back to the pre-1.94 code where Socket doesn't support IPv6. That's also probably not what is desired. One possible fix is to, instead of checking the version number, to instead check to see if the IPv6 ntoa-ish function exists using can(). Patch: diff -rp0 -c Net-SNMPTrapd-0.16/lib/Net/SNMPTrapd.pm Net-SNMPTrapd/lib/Net/SNMPTrapd.pm *** Net-SNMPTrapd-0.16/lib/Net/SNMPTrapd.pm 2015-03-19 18:23:25.000000000 -0600 --- Net-SNMPTrapd/lib/Net/SNMPTrapd.pm 2016-12-06 22:55:53.164891064 -0700 *************** sub _inetNtoa { *** 529 **** ! if ($Socket::VERSION >= 1.94) { --- 529 ---- ! if (Socket->can('pack_sockaddr_in6')) {
Saw this issue with another of my modules recently. Was solved with 'use version' and the parse() method. A bit of a issue here in that version() is already a sub in this module. Try this patch: Show quoted text
________ *** lib\Net\SNMPTrapd.pm 2015-03-19 21:23:25.000000000 -0400 --- lib\Net\SNMPTrapd.pm 2016-12-07 09:53:40.000000000 -0500 *************** use warnings; *** 9 **** --- 10,14 ---- + use version; + BEGIN { *Version:: = \*version:: } + # version module conflicts with 'sub version()' below. + # poor man's Package::Alias to avoid additional dependency + # http://www.perlmonks.org/?node_id=823772 *************** my $NI_NUMERICHOST = eval { Socket::NI_N *** 16 **** ! our $VERSION = '0.16'; --- 21 ---- ! our $VERSION = '0.16_1'; *************** sub _inetNtoa { *** 529 **** ! if ($Socket::VERSION >= 1.94) { --- 534 ---- ! if (Version->parse($Socket::VERSION) >= Version->parse(1.94)) {
________ Let me know if this works for you and I'll release as 0.17 to CPAN. Cheers.
Yep, that patch seems to have taken care of my issue - no more warnings.
On Wed Dec 07 11:14:10 2016, JMASLAK wrote: Show quoted text
> Yep, that patch seems to have taken care of my issue - no more warnings.
Thanks for testing. I'll finalize any more edits, change to version 0.17 and upload to CPAN in the next few days. Cheers.
Version 0.17 uploaded to CPAN this morning including 'use version' patch discussed in this thread. Thank you!