Here's what I had to do to install Net::SSH::Perl in my Windows ActivePerl 5.6.1 environment:

1. Use PPM3 to set the proper repository and install net-ssh-perl

ppm> rep add "U of Winnipeg" http://theoryx5.uwinnipeg.ca/ppms/package.xml
ppm> install net-ssh-perl -force –follow

2. Get Math-GMP-2.04 from CPAN.org and untar it. Build fails due to missing 'gmp.h' and 'gmp.lib' files, so you have to build 'em.

3. Get GMP from http://cs.nyu.edu/exact/core/gmp/ and follow instructions to build based on how your version of ActivePerl was built. My ActivePerl 5.6.1 was built using Microsoft VC, with ccflags including '-MD', so I followed the instructions for building GMP using this compiler, changing Project…Settings…C/C++…Project Options to use /MD instead of /ML. The build completes with 0 Erros and 132 Warnings.

4. Copy the resulting gmp.h and gmp.lib to the untarred Math-GMP-2.04 directory. Then build Math-GMP-2.04 using the standard Makefile.PL...nmake...nmake test...nmake install process.

5. Edit <perl>/site/lib/Net/SSH/Perl.pm and comment out these lines if you get the "Can't set socket non-blocking" error message:

# defined($sock->blocking(0))
# or die "Can't set socket non-blocking: $!";

Here's a test script you can use:

use Getopt::Std; use Net::SSH::Perl; &getopts('h:u:p:'); &Usage( ) unless( defined($opt_h) && defined($opt_u) && defined($opt_p +) ); $ssh = Net::SSH::Perl->new( $opt_h, port => 22 ); $ssh->login( $opt_u, $opt_p ); while( 1 ) { print "$opt_h\> "; $cmd = <STDIN>; $cmd =~ s/^\s+|\s+$//g; last if( $cmd eq "" ); ($stdout, $stderr, $exit_code) = $ssh->cmd($cmd); if( $exit_code ) { print $stderr; } else { print $stdout; } } exit( 0 ); sub Usage { print “Usage: $0 -h <host> -u <user> -p <password>\n”; exit( 0 ); } # end of Usage
HTH,
Dean Leonard

In reply to Re^2: Latest version of Perl - includes SFTP? by deansleonard
in thread Latest version of Perl - includes SFTP? by jhs3

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



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.