Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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;

  • In reply to Re: Net-SSH-W32Perl hanging (Solved) by cmv
    in thread Net-SSH-W32Perl hanging by Scrat

    Title:
    Use:  <p> text here (a paragraph) </p>
    and:  <code> code here </code>
    to format your post; it's "PerlMonks-approved HTML":



    • Are you posting in the right place? Check out Where do I post X? to know for sure.
    • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
      <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
    • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
    • Want more info? How to link or How to display code and escape characters are good places to start.
    Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Domain Nodelet?
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this?Last hourOther CB clients
    Other Users?
    Others learning in the Monastery: (6)
    As of 2024-04-23 13:57 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found