Skip Menu |

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

Report information
The Basics
Id: 71520
Status: resolved
Priority: 0/
Queue: Net-STOMP-Client

People
Owner: Nobody in particular
Requestors: KGOESS [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.2
Fixed in: 1.3



Subject: please correct use of UNIVERSAL::isa
In Net::STOMP::Client::IO, you're using UNIVERSAL like this: unless ($socket and UNIVERSAL::isa($socket, "IO::Socket")) { The old documentation for UNIVERSAL encouraged that idiom, but the current documentation highly discourages it (see http://perldoc.perl.org/UNIVERSAL.html under "but never do this!") because it means overridden methods will never work. The currently promoted idiom would be unless ($socket and $socket->isa("IO::Socket")) { I ran into this problem because I'm trying to use Test::MockObject to mock a Stomp connection for testing, but I can't mock IO::Socket with the current code. A patch is attached. Thanks!
Subject: net-stomp-client-io.patch
diff -Naur Net-STOMP-Client-1.2/lib/Net/STOMP/Client/IO.pm Net-STOMP-Client-patched/lib/Net/STOMP/Client/IO.pm --- Net-STOMP-Client-1.2/lib/Net/STOMP/Client/IO.pm 2011-09-27 07:46:51.000000000 +0200 +++ Net-STOMP-Client-patched/lib/Net/STOMP/Client/IO.pm 2011-10-07 15:55:36.000000000 +0200 @@ -32,7 +32,6 @@ use Net::STOMP::Client::Error; use IO::Select; use Time::HiRes qw(); -use UNIVERSAL qw(); # # constants @@ -48,7 +47,7 @@ my($class, $socket) = @_; my($self, $select); - unless ($socket and UNIVERSAL::isa($socket, "IO::Socket")) { + unless ($socket and $socket->isa("IO::Socket")) { Net::STOMP::Client::Error::report("Net::STOMP::Client::IO->new(): missing socket"); return(); }
The patch has been applied to the sources and the change will be part of the next release. Thanks for the bug report!