Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

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


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.


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:

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

The new version 1.34 of Net::SSH::Perl will incorrectly set
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
  • Setup a proxy (if needed): set HTTP_proxy=
  • 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 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(''); $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?

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

    How do I use this? | Other CB clients
    Other Users?
    Others meditating upon the Monastery: (10)
    As of 2015-10-09 18:02 GMT
    Find Nodes?
      Voting Booth?

      Does Humor Belong in Programming?

      Results (248 votes), past polls