Irfan J Sayed (isayed) wrote:
hi,
but I have mentioned the absolute path then perl interpreter should take the Perl.pm from "/home/cgadgil/usr/net/ssh/perl" it's very difficult for me to change the makefile as this is not under my control. i can change only this script. Please suggest
Regards
Irfan.
------------------------------------------------------------------------
*From:* Sandeep Kumar [mailto:[EMAIL PROTECTED]
*Sent:* Wednesday, August 13, 2008 5:39 PM
*To:* Irfan J Sayed (isayed)
*Cc:* beginners@perl.org
*Subject:* Re: Execute the Linux command on remote machine

Irfan J Sayed (isayed) wrote:
Still the error is same.

Following is the code

#! /usr/bin/perl;

# perl module to parse the AVMInstall.log file for errors

use lib "/home/cgadgil/usr/net/ssh/perl";
use Net::SSH::Perl;
    my $ssh = Net::SSH::Perl->new(avm-qa-cam2.cisco.com);
    $ssh->login(cgadgil, cgadgil);
    my($stdout, $stderr, $exit) = $ssh->cmd(ls);

Please help.

Regards
Irfan.
-----Original Message-----
From: Sandeep Kumar [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 13, 2008 3:27 PM
To: Irfan J Sayed (isayed)
Cc: beginners@perl.org
Subject: Re: Execute the Linux command on remote machine



Irfan J Sayed (isayed) wrote:
Hi All,
I want to execute one command on remote Linux machine. Following is the perl code. #! /usr/bin/perl; # perl module to parse the Install.log file for errors use lib "/tmp/";
use Net::SSH::Perl;
    my $ssh = Net::SSH::Perl->new(avm-qa-cam2.net.com);
    $ssh->login(cgadgil, cgadgil);
    my($stdout, $stderr, $exit) = $ssh->cmd(ls);
Actually i want to parse the log file for errors which is on the remote machine. so i want to execute some commands on remote machine. for example ls I have copied the Perl.pm in the /tmp folder but still i am getting @INC error. Can't locate Net/SSH/Perl.pm in @INC (@INC contains: /tmp/ /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.7/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi
Please suggest. Regards
Irfan.
you can better make a ~/usr , and copy the package there and  use lib
"/home_dir/usr/net/ssh/perl", you cannot have use lib "~/net/ssh/perl",
this does not work(for me, it didn't).

sandeep.


what i meant was you can change the Make file for the package to copy the libraries in ~/usr/lib, then you can use
use lib "/home/cgadgil/usr/lib/perl5/site_perl/5.8.0";
it basically is just looking for a absolute path to the Net folder in lib path.

sandeep.
the error you get is :

you only need to point to the Net package. so no need to add /net/ssh, you can 
see this from the error you got
Can't locate Net/SSH/Perl.pm in @INC.

Since you do not want to edit the Makefile,you can use
/home/home_dir/Net-SSH-1.30/lib/
you just have to point to the Net folder.

i hope you have downloaded this package, as it is not inbuilt in perl.
in case not, find it here:
http://search.cpan.org/~dbrobins/Net-SSH-Perl-1.28/


sandeep.




Reply via email to