Skip Menu |
 

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

Report information
The Basics
Id: 42722
Status: rejected
Priority: 0/
Queue: Net-Stomp

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

Bug Information
Severity: Normal
Broken in: 0.34
Fixed in: (no value)



Subject: die() in constructor considered suboptimal
Download (untitled) / with headers
text/plain 664b
In building an app around Net::Stomp and POE::Component::MessageQueue, I noticed the following lines in Net/Stomp.pm: 19 die "Error connecting to " . $self->hostname . ':' . $self->port . ": $!" 20 unless $socket; Calling die() in a module should be generally considered a no-no. Far better would seem to perhaps Carp::carp() and then return undef for the object constructor. It is easily worked around by users by wrapping the constructor in an eval {} block (which I've done), but it seems sort of rude to kill a user's app without permission, as perhaps not being able to connect to the Stomp server is not a fatal error to the object consumer :-)
Download (untitled) / with headers
text/plain 216b
Perl doesn't really have exceptions, and this is a fairly crucial error for simple applications. Frameworks like yours will be clever enough to figure out it shouldn't be fatal. Marking as not a bug, sorry ;-) Leon


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.