in reply to Re: Net::SFTP using ssh_args woes
in thread Net::SFTP using ssh_args woes

Do you use login like: $sftp = Net::SFTP::->new($host, %login)? I haven't ever used Net::SFTP, but from a quick glace at the source, it looks like ssh_args => is supposed to be there and is supposed to be followed by an ref to an array containing extra parameters to put in the call to Net::SSH::Perl::->new. It's hard to see how what you have would work:
sub new { my $class = shift; my $sftp = bless { }, $class; $sftp->{host} = shift; $sftp->init(@_); } sub init { my $sftp = shift; my %param = @_; $sftp->{debug} = delete $param{debug}; $param{ssh_args} ||= []; $sftp->{_msg_id} = 0; my $ssh = Net::SSH::Perl->new($sftp->{host}, protocol => 2, debug => $sftp->{debug}, @{ $param{ssh_args} }); ...
with no further use of @_ in init(). It looks like you want something like (completely untested):
$sftp = Net::SFTP::->new($host, user => $username, password => $password, ssh_args => [ options => [ "StrickHostKeyChecking no" ] ] );
Which is basically what the doc says, except that both modules say reference to a list where they mean reference to an array.

Replies are listed 'Best First'.
Re: Net::SFTP using ssh_args woes
by b10m (Vicar) on Jan 11, 2004 at 15:07 UTC

    I stand corrected, you are right, but due to the odd behaviour of SFTP (see for example PM search "Net::SFTP"), I switched back to the plain old Net:FTP (for the "employer" didn't care too much about it anyway ;)

    Your coding seems valid, yet I made a mistake of believing "StrictHostKeyChecking no" (as found in `man ssh_config`) would work with Net::SSH::Perl, but it doesn't, so basically, the "ssh_args" flag is useless in my case anyway ;)

    --
    b10m