CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
How to install Net::SSH perl module

 



forumrhb
Novice

Jul 19, 2013, 2:40 AM

Post #1 of 3 (12224 views)
How to install Net::SSH perl module Can't Post

How to install Net::SSH perl module

I am running a perl script on my windows box to run a command on linux box. i am getting below error

Can't locate Net/SSH/Perl.pm in @INC (@INC contains: C:/Perl/site/lib C:/Perl/li
b .) at C:\package\ssh_build.pl line 6.
BEGIN failed--compilation aborted at C:\package\ssh_build.pl line 6.



###################################
use Net::SSH::Perl;

my $host = "xx.xx.xx.xx";
my $user = "root";
my $password = "simple";

#-- set up a new connection
my $ssh = Net::SSH::Perl->new($host);
#-- authenticate
$ssh->login($user, $pass);
#-- execute the command
my($stdout, $stderr, $exit) = $ssh->cmd("ls -l /home/user");
###################################


Laurent_R
Veteran / Moderator

Jul 19, 2013, 10:41 AM

Post #2 of 3 (12218 views)
Re: [forumrhb] How to install Net::SSH perl module [In reply to] Can't Post

Depending on whether you are on ActivePerl or Strawberry Perl, the installation procedures will be very different. Please tell us which version you are running.

From your error message, it would seem that you might need to have a C compiler installed on your box. Do you have that?

Having said that, I will not be able to help you much further, since I am not using Perl on Windows.


2teez
Novice

Jul 28, 2013, 1:39 PM

Post #3 of 3 (12091 views)
Re: [forumrhb] How to install Net::SSH perl module [In reply to] Can't Post

You probably don't have Net::SSH::Perl installed on your system. Since the module you used could not be found in the standard directory of Perl. I used the word 'probably' because you may have the module installed in another directory, and as such you need to specify such either on the CLI using "-I path_to_the_directory" or

Code
 use lib 'path_to_the_directory';

in your script.
However, if this module is not installed on your system then you could do like so: From your CLI

Code
perl -MCPAN -eshell 

cpan> install Net::SSH::Perl

Checking the module on https://metacpan.org/module/Net::SSH::Perl I see that it has a lot of dependencies, so it might not be very funny using the above method to install.
So, if you have CPANMINUS installed on your system, then you could then just do: From the command line interface

Code
cpanm Net::SSH::Perl

Then you can go to sleep Wink because every thing just works fine.
For cpanminus that takes all the pain away see https://metacpan.org/module/App::cpanminus.


(This post was edited by 2teez on Jul 28, 2013, 1:41 PM)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives