Skip Menu |

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

Report information
The Basics
Id: 64853
Status: resolved
Priority: 0/
Queue: Net-VNC

People
Owner: Nobody in particular
Requestors: ktdreyer@ktdreyer.com (no email address)
Cc:
AdminCc:

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



Subject: better errors with IO::Socket::INET
Thanks for Net::VNC. I'm using it to write a Nagios plugin. You can improve the errors with IO::Socket::INET by dying with the full error message. It is better to die with "$@" than with "$!". The latter will only give a cryptic "Invalid argument". The former will actually tell you the error (eg. "IO::Socket::INET: Bad hostname 'asdf'"). From http://www.stonehenge.com/merlyn/UnixReview/col47.html <quote> use IO::Socket::INET; my $connection = IO::Socket::INET->new(@parameters) or die "Cannot connect: $@"; Note that the error comes back in $@, not $!. (Some have argued that this is a misdesign, either on Perl's part or on the author's part, but we're stuck with the inconsistency either way.) </quote>
Subject: vnc-inet-error.patch
--- VNC.pm.old 2009-11-23 09:35:13.000000000 -0700 +++ VNC.pm 2011-01-17 13:50:59.000000000 -0700 @@ -157,7 +157,7 @@ PeerAddr => $hostname || 'localhost', PeerPort => $port || '5900', Proto => 'tcp', - ) || die "Error connecting to $hostname: $!"; + ) || die "Error connecting to $hostname: $@"; $socket->timeout(15); $self->socket($socket);
Thanks, this will be in the next release. Leon