Skip Menu |

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

Report information
The Basics
Id: 70758
Status: resolved
Worked: 5 hours (300 min)
Priority: 0/
Queue: Net-SFTP-Foreign

People
Owner: salva [...] cpan.org
Requestors: LEEJO [...] cpan.org
Cc: lee.johnson [...] netbanx.com
AdminCc:

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



CC: lee.johnson [...] netbanx.com
pmvers Net::SFTP::Foreign:1.67 perl -V: Summary of my perl5 (revision 5 version 10 subversion 1) configuration: Platform: osname=linux, osvers=2.6.18-128.1.14.el5, archname=i686-linux The third arg to Net::SFTP::put is a callback whereas the third argument to Net::SFTP::Foreign::put is a hash of options. This means you can't currently call Net::SFTP::Foreign::put in :compat mode, with options, without the fatal error "Can't use string ("copy_perms") as a subroutine ref". It would be useful to be able to pass these options in :compat mode. Quick and untested patch for Net::SFTP::Foreign::Compat: 118 sub put { 119 my $sftp = shift; 120 my $local = shift; 121 my $remote = shift; 122 123 if (@_ && defined($_[0]) && ref($_[0]) eq 'CODE') { 124 unshift(@_,'callback'); 125 } 126 127 $sftp->SUPER::put($local, $remote, @_); 128 $sftp->_warn_error; 129 !$sftp->SUPER::error; 130 }
On Tue Sep 06 06:24:02 2011, LEEJO wrote: Show quoted text
> pmvers Net::SFTP::Foreign:1.67 > perl -V: Summary of my perl5 (revision 5 version 10 subversion 1) > configuration: > Platform: osname=linux, osvers=2.6.18-128.1.14.el5, archname=i686-linux > > The third arg to Net::SFTP::put is a callback whereas the third argument > to Net::SFTP::Foreign::put is a hash of options. This means you can't > currently call Net::SFTP::Foreign::put in :compat mode, with options, > without the fatal error "Can't use string ("copy_perms") as a subroutine > ref". > > It would be useful to be able to pass these options in :compat mode. > Quick and untested patch for Net::SFTP::Foreign::Compat: > > 118 sub put { > 119 my $sftp = shift; > 120 my $local = shift; > 121 my $remote = shift; > 122 > 123 if (@_ && defined($_[0]) && ref($_[0]) eq 'CODE') { > 124 unshift(@_,'callback'); > 125 } > 126 > 127 $sftp->SUPER::put($local, $remote, @_); > 128 $sftp->_warn_error; > 129 !$sftp->SUPER::error; > 130 }
I see no reason to expand the Compat module beyond supporting the Net::SFTP API. What's the point? If compatibility with Net::SFTP does not bother you, just use Net::SFTP::Foreign native API that's much better. Anyway, the latest version I have just released, 1.68_04, supports the %DEFAULTS feature that allows to set default options for the Net::SFTP::Foreign methods being called under the hood by Net::SFTP::Foreign::Compat.
Show quoted text
> I see no reason to expand the Compat module beyond supporting the > Net::SFTP API. What's the point?
These is reasonable enough, but I would argue that in its current state the compat put method is prone to failure due to the SUPER class tryin returning false if calls to [f]setstat fail. Net::SFTP ignores failure from any calls to [f]setstat in its put method.
Show quoted text
> These is reasonable enough, but I would argue that in its current state > the compat put method is prone to failure due to the SUPER class tryin > returning false if calls to [f]setstat fail. Net::SFTP ignores failure > from any calls to [f]setstat in its put method.
I have uploaded version 1.70_05 to CPAN implementing the best_effort mode making get and put methods ignore minor errors (as stat/setstat calls failing). Now, the methods get and put from the Compat module use that best_effort mode and so behave as the Net::SFTP ones.