in reply to Re: Latest version of Perl - includes SFTP?
in thread Latest version of Perl - includes SFTP?

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