dwhitney has asked for the wisdom of the Perl Monks concerning the following question:

Most glorious and wise monks, I beeshech your help. I finally got all the packages nessary for Net::SFTP installed, yet I keep running into the same problem. First, the code:
use Net::SFTP; my %args = ( user => $Username, password => $Password, debug => 0, protocol => '1,2', port => '22', ); my $sftp = Net::SFTP->new( $Host, %args ) or $self->logcroak( "SFTP Object Error: $@" ); printf "<= SFTP Dump => %s\n%s\n", Dumper( \%args ), Dumper( $sftp ); die "Foo!\n";
My Results:
Use of uninitialized value in concatenation (.) or string at C:/Apps/p +erl/site/lib/Net/SSH/Perl.pm line 107. Can't map service name 'ssh' to port number at C:/Apps/perl/site/lib/N +et/SFTP.pm line 36
From what I can see it dies in the new call, so no log message, but I'll be darned if I can find an answer as to what to do. Thank you. ++Dennis Update
Well, I've been pounding my head on this for a while and it does not look like you can use Net::SFTP on a windows box.
I'll keep trying and report back what I find, but I get the creapy feeling that this will not work...

Replies are listed 'Best First'.
Re: Using Net::SFTP on a windows system.
by shenme (Priest) on Mar 03, 2005 at 02:29 UTC
    Net::SSH::Perl seems to expect that you will have either setup the 'user_config' parameter in the original new() call or will have environment variable 'HOME' set so that it can look for "$ENV{HOME}/.ssh/config". I think that is the source of your uninitialized value. (looking in Net::SSH::Perl.pm to see this)

    Because there was no config (guessing here) the port defaulted to 'ssh'. When Net::SSH::Perl tried to lookup 'ssh' using getservbyname() it couldn't find the definition and so died. Perhaps your <windir>\system32\drivers\etc\services file doesn't have a definition for "ssh 22/tcp", or perhaps the system can't find this file?

      You were right that I needed to update 'services' file. I still get an error, but at least it is a different one...
Re: Using Net::SFTP on a windows system.
by hsinclai (Deacon) on Mar 03, 2005 at 00:57 UTC
    By chance -- did you check that  $Host is in fact listening with an sshd on port 22? It looks like there's no server on the server side!
      Honest question ;)!
      Yes. I checked the address, and used an ftp client to connect to the sftp server. Which worked just fine.