I hope the list can help contribute a complete working solution to this
so that it's documented in at least one place. I've been digging around
all over the place with testimonies that Net::SSH::W32Perl with
Net::SFTP works, but it's evading me.

It still seems that soulcage.net is down, but Randy helped out with
uwinnipeg. Nice one mate. So supposedly I'm up and running with
Net::SSH::W32Perl on my laptop (WinXP Pro SP2), and my Linux machine
which is setup with SSH2. Apparently not. 

I was facing the same problem as Adrian on
http://www.mail-archive.com/[email protected]/ms
g34324.html - $Bill said he had it working but he didn't say how. Anyway
I did some googling and it seems that you need to redirect all commands
that write output to STDOUT. Fair enough I can live with that and this
works:-

use strict;
use warnings;
use Net::SFTP;
use Net::SSH::W32Perl;

my $User = 'NetTelnetIs';
my $Pwd = ' IAj+D+DY4;\\ FDZ6'^'T!$JO+L7yVT0L)\'1E';
my $host = 'mickey.atdisney.com';
my $ssh = new Net::SSH::W32Perl($host, debug => 1, use_pty => 0);
$ssh->login($User, $Pwd);

my $Cmd = "cd ~mickey/Tools ; ls -lrt ; grep -v minnie > hola.txt";
my ($out, $err, $exit) = $ssh->cmd($Cmd, "\n");
print "out = ###$out###\n";
print "err = ###$err###\n";
print "exit = ###$exit###\n";

Needless to say out and err are blank but hola.txt gets written.
Nevermind I said - I can SFTP over hola.txt and I can parse out what I
want. Somehow I guessed that Net::SFTP is going to have some nuances of
it's own, and low and behold I come up with this
http://aspn.activestate.com/ASPN/Mail/Message/2284607

So I modified SFTP.pm to make use Net::SSH::Perl 1.24; read use
Net::SSH::W32Perl;

And I appended the following to the code above:-

my $sftp = Net::SFTP->new($host, user => $User, password => $Pwd, debug
=> 1);
$sftp->get("hola.txt", "hola.txt");

I ran that and got this:-
----8<--------
Can't set socket non-blocking: Bad file descriptor at
C:/Perl/site/lib/Net/SSH/Perl.pm line 212, <GEN4> line 1.


So I comment out that line (Looks like Roland filed a bug for this
http://aspn.activestate.com/ASPN/Mail/Message/2723646).

And that's where it stops/hangs:-
----8<--------
annabelle: Login completed, opening dummy shell channel.
annabelle: channel 0: new [client-session]
annabelle: Requesting channel_open for channel 0.
annabelle: channel 0: open confirm rwindow 100000 rmax 16384
annabelle: channel 1: new [client-session]
annabelle: Requesting channel_open for channel 1.
annabelle: Sending subsystem: sftp
annabelle: Requesting service subsystem on channel 1.
annabelle: channel 1: open confirm rwindow 100000 rmax 16384


I don't really need Net::SFTP to work I would prefer to have content
written to $out, however if redirection is the only way then what else
do I need to get SFTP going?

Thanks,

Just in

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to