Skip Menu |

This queue is for tickets about the libnet CPAN distribution.

Report information
The Basics
Id: 110978
Status: resolved
Priority: 0/
Queue: libnet

People
Owner: Nobody in particular
Requestors: ppisar [...] redhat.com
Cc:
AdminCc:

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



Subject: Calling non-existent timeout method
After upgrading libnet from 3.07 to 3.08, I receive a test failure in Net-SNPP-1.17. It complains on undefined timeout() method: $ perl -Ilib -I/home/test/fedora/perl-libnet/libnet-3.08/lib t/server.t 1..15 ok 1 - use Net::SNPP::Server; ok 2 - use Net::SNPP; ok 3 - created a server # test server up and running on 20444 # attempting to connect to server using Net::SNPP Can't locate object method "timeout" via package "Net::SNPP::Server" at /home/test/fedora/perl-libnet/libnet-3.08/lib/Net/Cmd.pm line 201. not ok 4 - connected to server using Net::SNPP client # Failed test 'connected to server using Net::SNPP client' # at t/server.t line 32. Can't call method "ping" on an undefined value at t/server.t line 39. # Looks like you planned 15 tests but ran 4. # Looks like you failed 1 test of 4 run. # Looks like your test exited with 9 just after 4. The Net::SMP::Server inherits from Net::Cmd and Net::Cmd on line 201 is: sub _syswrite_with_timeout { my $cmd = shift; my $line = shift; my $len = length($line); my $offset = 0; my $win = ""; vec($win, fileno($cmd), 1) = 1; → my $timeout = $cmd->timeout || undef; [...] } It looks like Net::Cmd expects the extending class should define the timeout() method, but Net::Cmd documentation does not document this requirement. So either it's a bug in Net::Cmd documentation, or Net::Cmd should define the method too, or the check for $cmd->timeout value should be more robust to cope with missing timeout() method. What's your opinion?
On Thu Jan 07 08:12:07 2016, ppisar wrote: Show quoted text
> After upgrading libnet from 3.07 to 3.08, I receive a test failure in > Net-SNPP-1.17. It complains on undefined timeout() method:
Sorry for the breakage. I hadn't noticed that timeout() isn't provided (or documented as required to be provided by subclasses). There were calls to timeout() already in 3.07, but 3.08 added some more so one of the new calls must be tripping things up. Show quoted text
> > It looks like Net::Cmd expects the extending class should define the > timeout() method, but Net::Cmd documentation does not document this > requirement. > > So either it's a bug in Net::Cmd documentation, or Net::Cmd should > define the method too, or the check for $cmd->timeout value should be > more robust to cope with missing timeout() method. > > What's your opinion?
This is code that I've picked up maintenance of, so I can only guess what the original intent here was. My guess would be that it's a documentation bug, given that there's an example subclass in t/datasend.t which defines a timeout() method. That said, it certainly wouldn't hurt for Net::Cmd to safely handle a case of timeout() being missing too. I will get this fixed in the next release. Thanks for the report.
Thanks again for the report. Now fixed by: https://github.com/steve-m-hay/perl-libnet/commit/91e593b615334fa76ef0454c4e601b98b6663841 This will be in 3.09.