Folks-
I spent a few days tracking this down (I really like Net::SSH::Perl and friends) and believe I have a solution.
Hope it helps.
-Craig
Short answer
A bug was introduced in Net::SSH::Perl (in version 1.34 and maybe earlier), that breaks Net::SSH::W32Perl, and gives you the symptom above. I will be submitting a bug report.
More Details
The bug appears in the file:
c:\Perl\site\lib\Net\SSH\Perl.pm
In order to fix the problem, I modified these lines:
my $proto_class = join '::', __PACKAGE__,
($proto == PROTOCOL_SSH2 ? "SSH2" : "SSH1");
To look like this (what the original code was):
my $proto_class = $ssh->protocol_class($proto);
This fixes the problem for me.
Even More Details
If you are using Net::SSH::W32Perl to access the Net::SSH::Perl modules from your windows PC, the original Net::SSH::Perl code would correctly set
$proto_class='Net::SSH::W32Perl::SSH2'
The new version 1.34 of Net::SSH::Perl will incorrectly set
$proto_class='Net::SSH::Perl::SSH2'
which causes Net::SSH::W32Perl all sorts of grief, and your remote commands end up hanging.
Some folks have asked for a recipie for installing Net::SSH::Perl & friends on a PC. Here is how I do it...
Execute the MSI from the Activestate website on your PC to install a clean version of the latest perl (I use 5.8.9.825)
Setup a proxy (if needed): set HTTP_proxy=http://my.proxy.com:8888
Run ppm
Setup ppm for Activestate to be your only repository (unselect all others)
Add the latest IO-Select-Trap module
View & upgrade all upgradable packages
Setup tcool (from Suggested list) as your only repository
Add the latest Net-SSH-Perl and Math-BigInt-GMP (for Crypt-DSA) modules
Setup uwinnipeg (from Suggested list) as your only repository
Add the latest Net-SSH-W32-Perl module
Modify the Perl.pm file as stated above
Run the following test script
use strict;
use warnings;
use Net::SSH::W32Perl;
# Set $HOME (if not set), to avoid another Net::SSH::Perl bug...
if(! $ENV{HOME}) { $ENV{HOME}='c:\\' };
my $ssh=Net::SSH::W32Perl->new('myhost.com');
$ssh->login('myuser', 'mypasswd');
my ($stdout, $stderr, $exit) = $ssh->cmd('uname -a; date; uname -a');
print STDERR "exit=$exit\n";
print STDERR "STDERR: $stderr\n" if $stderr;
print STDERR "STDOUT: $stdout\n" if $stdout;
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.