Net::SFTP ssh_args=>[ ] syntax question...

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I'm not sure if this is the right place to post for syntax questions,
but please help or at least let me know where I should post for

There's an example psftp script in the Net::SFTP module directory
which defines the following argument hash to pass into sftp:

my %args = (ssh_args => []);  # from the perl man pages, it looks like
                              # ssh_args can be any arguments
                              # accepted by Net::SSH, so I guess
                              # I can put a hash list within
                              # a hash?

I wasn't able to run that script cleanly to test if my Net::SFTP
module was installed correctly so I wrote a smaller script to test:

use strict;

use Net::SFTP;

<$host, $user and $pass definined here>
my %args = (user => "$user", password => "$pass");
my $sftp = Net::SFTP->new($host, %args);
$sftp->put("testfile", "/var/tmp/remotetest");

When I ran my transfer program, it exits with a complaint that it does
not know what port 'ssh' is and made reference to the Net::SSH::Perl
pm file...

I added ssh port 22 in my /etc/services file to temporarily fix this,
but I am really curious as to how I can define the ssh port within my
argument hash?

my %args = (user => "$user", password => "$pass", ssh_args => [port =>

Is the above right?  I don't see the [ ] signs used too often outside
of pattern class definitions, the only time I saw this was with slices
so I'm not sure what the correct way to input additional ssh arguments
into the ssh_args option.


Re: Net::SFTP ssh_args=>[ ] syntax question...

Cancelling this post. I wasn't sure where to post this message, this
was also posted on the comp.lang.perl.misc site and was answered.

Site Timeline