[Ssh-sftp-perl-users] Net::SFTP error handling patch
Brought to you by:
dbrobins
From: David R. <dr...@at...> - 2004-12-14 21:07:27
|
Patch is attached. It makes the following changes, all of which I = believe are backwards compatible: 1. adds a 'warn' argument to the constructor; it can be true (default - = warn as usual), false (supress the output of warnings), or a sub ref = (called with the SFTP object and the warning text) 2. adds a 'status' method which returns the last SSH2_FX_* status value, = or (status value, text) in list context (only useful after last failure) 3. allows ssh_args to be either a hash ref or an array ref 4. adds brief summary comments to some methods 5. returns failure if the remote open fails for 'get' (current code = ignored it); also moves the remote open before the local open so that we = don't create empty local files if the remote file can't be opened 6. changes ls to return an array reference in scalar context 7. documents: the fact that we die on protocol/local errors; the new = option and method; changes to get/put (formerly 'put' didn't return = anything useful, and 'get's actual return values are the same, just = better documented) 8. adds a comprehensive remote test, but to use it one has to manually = go in and configure a server a certain way, so it defaults to skipping = everything; I'm including it as a base since there are currently no = remote tests at all Naturally, modify as you see fit, or if you need me to make changes I'll = be glad to. > -----Original Message----- > From: ssh...@li... > [mailto:ssh...@li...]On Behalf Of > Mihai Secasiu > Sent: Sunday, December 12, 2004 1:21 PM > To: ssh...@li... > Subject: Re: [Ssh-sftp-perl-users] Net::SFTP error handling - patch? >=20 >=20 > You can send the patch here, I will review it and merge it=20 > into the code.=20 > On Friday 10 December 2004 23:48, David Robins wrote: > > I'd like to add some error handling with the result of=20 > having Net::SFTP's > > put method return success (true)/failure (false), and=20 > perhaps some other > > patches too: > > > > - similar return for 'get' (unless there's no local file=20 > specified, in > > which case the file contents are returned) (as reported=20 > [not by me] about a > > year ago at http://rt.cpan.org/NoAuth/Bug.html?id=3D4610) -=20 > allow warnings to > > be redirected to a callback (or turned off), defaulting to warn for > > backwards compatibility > > > > If these seem like a good idea I'll write up and submit a=20 > patch (if I do, > > where should I send it to, this list?) |