Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Net-SSH-W32Perl hanging (Solved)

by cmv (Chaplain)
on Apr 16, 2009 at 20:39 UTC ( #758068=note: print w/ replies, xml ) Need Help??


in reply to Net-SSH-W32Perl hanging

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;

  • Comment on Re: Net-SSH-W32Perl hanging (Solved)
    Select or Download Code

    Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Node Status?
    node history
    Node Type: note [id://758068]
    help
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others about the Monastery: (18)
    As of 2015-07-01 19:45 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









      Results (18 votes), past polls