Subject: | Patch to improve debug message handling |
Date: | Mon, 03 Aug 2009 15:04:02 +0100 |
To: | bug-Net-FTP-AutoReconnect [...] rt.cpan.org |
From: | Lee Johnson <lee.johnson [...] netbanx.com> |
We've recently had reason to use your Net::FTP::AutoReconnect module to
help with transfers to some seriously shakey ftp servers. Whilst adding
the module and running my own ftp tests I noticed a couple of things
that could be added to improve the debug message and also a bug in the
way a couple of return values were handled.
I've attached/appended the patch, it applies to the current revision of
the module, 0.2, on CPAN:
- module now reports difference between initial connection and
reconnection and uses passed Debug arg to Net::FTP as well as
$ENV{DEBUG},
- $@ used in error message when Net::FTP object fails to connect,
- removed defined check on return value in subs cwd and cdup because
when these commands fail they return '' not undef.
Show quoted text
-------- PATCH FOLLOWS --------
79a80
> %{ $self->{args} } = @_;
81c82
< $self->reconnect();
---
> $self->reconnect( 0 );
103,104c104,108
< warn "Reconnecting!\n"
< if ($ENV{DEBUG});
---
> my $is_reconnect = shift;
> my $connection_type = ($is_reconnect) ? "Reconnecting" :
"Connecting";
>
> warn join(' ',ref($self),$connection_type)
> if ($ENV{DEBUG} or $self->{args}{Debug});
107c111
< or die "Couldn't create new FTP object\n";
---
> or die "Couldn't create new FTP object: $@\n";
162c166
< $self->reconnect();
---
> $self->reconnect( 1 );
238c242
< if (defined($ret))
---
> if ($ret)
251c255
< if (defined($ret))
---
> if ($ret)
Message body is not shown because sender requested not to inline it.