Skip Menu |

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

Report information
The Basics
Id: 58407
Status: resolved
Priority: 0/
Queue: Net-POP3-SSLWrapper

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

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



Subject: Better error diagnostics on failed connects
Many thanks for this clever module. I found only a problem if the connection to a pop3s server fails. In these cases, the error message reads like this: Can't call method "blocking" on an undefined value at /usr/share/perl5/Net/POP3/SSLWrapper.pm line 26. Which is quite confusing. Attached is a patch to change this into the standard Net::POP3 behavior, which is just to return undef in case of connection problems. In the patch is also a test case for the "can't connect" case. Regards, Slaven
Subject: 0001-better-error-handling-in-case-of-failed-connects-wit.patch
From 59f7b08c445f5d00fb7517ff57ddc761bf58ad47 Mon Sep 17 00:00:00 2001 From: Slaven Rezic <srezic@iconmobile.com> Date: Tue, 15 Jun 2010 15:48:41 +0200 Subject: [PATCH] better error handling in case of failed connects (with new test) --- lib/Net/POP3/SSLWrapper.pm | 1 + t/10_noconn.t | 10 ++++++++++ 2 files changed, 11 insertions(+), 0 deletions(-) create mode 100755 t/10_noconn.t diff --git a/lib/Net/POP3/SSLWrapper.pm b/lib/Net/POP3/SSLWrapper.pm index 1917247..db9e8dd 100644 --- a/lib/Net/POP3/SSLWrapper.pm +++ b/lib/Net/POP3/SSLWrapper.pm @@ -19,6 +19,7 @@ sub new { my $class = shift; my $self = $class->SUPER::new(@_); + return if !$self; $self->blocking(0); # XXX why need this? return $self; } diff --git a/t/10_noconn.t b/t/10_noconn.t new file mode 100755 index 0000000..3f96099 --- /dev/null +++ b/t/10_noconn.t @@ -0,0 +1,10 @@ +use strict; +use warnings; +use Test::More tests => 1; + +use Net::POP3; +use Net::POP3::SSLWrapper; + +pop3s { + ok(!Net::POP3->new('pop3.example.com'), 'Expected connection failure'); +}; -- 1.7.0.3
Subject: Re: [rt.cpan.org #58407] Better error diagnostics on failed connects
Date: Wed, 16 Jun 2010 11:22:32 +0900
To: bug-Net-POP3-SSLWrapper [...] rt.cpan.org
From: Tokuhiro Matsuno <tokuhirom [...] gmail.com>
thanks. applied your patch and released N::P::SSLWrapper 0.04! regards, On Tue, Jun 15, 2010 at 10:55 PM, Slaven_Rezic via RT <bug-Net-POP3-SSLWrapper@rt.cpan.org> wrote: Show quoted text
> Tue Jun 15 09:55:27 2010: Request 58407 was acted upon. > Transaction: Ticket created by SREZIC >       Queue: Net-POP3-SSLWrapper >     Subject: Better error diagnostics on failed connects >   Broken in: 0.03 >    Severity: (no value) >       Owner: Nobody >  Requestors: SREZIC@cpan.org >      Status: new >  Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=58407 > > > > Many thanks for this clever module. > > I found only a problem if the connection to a pop3s server fails. In > these cases, the error message reads like this: > >    Can't call method "blocking" on an undefined value at > /usr/share/perl5/Net/POP3/SSLWrapper.pm line 26. > > Which is quite confusing. Attached is a patch to change this into the > standard Net::POP3 behavior, which is just to return undef in case of > connection problems. In the patch is also a test case for the "can't > connect" case. > > Regards, >    Slaven > >