Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Not able to use Net::SFTP module.

by vinoth.ree (Monsignor)
on Apr 29, 2014 at 06:40 UTC ( [id://1084255]=note: print w/replies, xml ) Need Help??


in reply to Not able to use Net::SFTP module.

Hi,

If you downloaded .tar.gz file from cpan, then you need to download the dependencies also and need to install manually.

The simplest way to get Perl modules installed is to use the CPAN module itself. If you are the system administrator and want to install the module system-wide, you'll need to switch to your root user. To fire up the CPAN module, just get to your command line and run this: perl -MCPAN -e shell

If this is the first time you've run CPAN, it's going to ask you a series of questions - in most cases the default answer is fine. Once you find yourself staring at the cpan> command prompt, installing a module is as easy as, cpan> install Net::SFTP

Update: Sorry to feed you with additional info, I faced the same problem of installing dependencies so, i am sharing that.

If you use cpancommand, it constantly confirms installing dependencies. While this is an annoyance if you have to install a module with many dependencies, you can tell CPAN to automatically confirm the installation of dependencies.

To do this, simply bring up a CPAN shell:

perl -MCPAN -e shell

Run these two commands in the CPAN shell:

o conf prerequisites_policy follow o conf commit

Now, exit the CPAN shell, start the CPAN shell, and try to install a module that you need. All dependencies will be automatically confirmed, downloaded and installed.

The first line sets your dependency policy to follow rather than ask (default). The second line tells CPAN to write the changes to your user’s CPAN configuration file to make them permanent


All is well

Replies are listed 'Best First'.
Re^2: Not able to use Net::SFTP module.
by Ankur_kuls (Sexton) on Apr 29, 2014 at 08:26 UTC

    Thanx a lot for your reply. I followed the steps but stll getting the same error. Here my script looks like..

    #! usr/bin/perl use strict; use warnings; use Net::SFTP; use Net::SSH::Perl::Buffer; my $host = "*************"; my $userid = "****"; my $pwd = "******"; my $f = Net::SFTP->new($host) or die "couldn't connect"; $f->login($userid, $pwd) or die "couldn't login"; print "successfully logged in\n";
    error: Can't locate Net/SSH/Perl/Buffer.pm in @INC (@INC contains: /etc/perl +/usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl +5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local +/lib/site_perl .) at /usr/local/share/perl/5.14.2/Net/SFTP/Buffer.pm +line 6. BEGIN failed--compilation aborted at /usr/local/share/perl/5.14.2/Net/ +SFTP/Buffer.pm line 6. Compilation failed in require at /usr/local/share/perl/5.14.2/Net/SFTP +/Attributes.pm line 7. BEGIN failed--compilation aborted at /usr/local/share/perl/5.14.2/Net/ +SFTP/Attributes.pm line 7. Compilation failed in require at /usr/local/share/perl/5.14.2/Net/SFTP +.pm line 8. BEGIN failed--compilation aborted at /usr/local/share/perl/5.14.2/Net/ +SFTP.pm line 8. Compilation failed in require at ankur_ftp.pl line 5. BEGIN failed--compilation aborted at ankur_ftp.pl line 5.

    beacuse of the error in very first line I installed Net::SSH::Perl::Buffer module too. But didn't work..Could you please tell me in detail what needs to be done here...

      What needs to be done is that you need to give us enough information to allow us to help. "But didn't work" isn't anything anyone can help you with. I already asked how you install modules. Please read and understand How do I post a question effectively?.

        @Marto: I pasted my script, I pasted the error it threw, I also explained what I did, I also mentioned that I followed the steps explained by Vinoth. I wonder, what else do you need as being a beginner i don't have sufficient understanding. I advise you should go through some kinda article "How to understand a question". still I appreciate you responded.

      Hi,

      marto is asking how did u install those modules ? Did you install them by downloading tar.gz or installed through cpan command ?

      If you have installed with tar.gz file it could have showed you the path where this module get installed. If the module is not installed in the shared lib path, you need to add that path into @INC variable as,

      #! usr/bin/perl BEGIN { unshift(@INC,"/path/where/installed/"); } use strict; use warnings; use Net::SFTP; use Net::SSH::Perl::Buffer; my $host = "*************"; my $userid = "****"; my $pwd = "******"; my $f = Net::SFTP->new($host) or die "couldn't connect"; $f->login($userid, $pwd) or die "couldn't login"; print "successfully logged in\n";

      If you are not sure where it get installed find it with the find command.


      All is well

        Hi, I installed the modules using CPAN command and tried to follow the steps provided by you.

        #! usr/bin/perl BEGIN { unshift (@INC, "/home/eankuls/.cpan/build/Net-SSH-Perl-1.37-AUG9Mn/bli +b/lib/Net/SSH/Perl"); } use strict; use warnings; use Net::SFTP; use Net::SSH::Perl::Buffer; my $host = "rinacac-test.egi.ericsson.com"; my $userid = "root"; my $pwd = "red32hat"; my $f = Net::SFTP->new($host) or die "couldn't connect"; $f->login($userid, $pwd) or die "couldn't login"; print "successfully logged in\n"; eankuls@L9AHR43:~$ ls -ltr /home/eankuls/.cpan/build/Net-SSH-Perl-1.37 +-AUG9Mn/blib/lib/Net/SSH/Perl/Buffer.pm -r--r--r-- 1 eankuls egi 9725 Aug 10 2013 /home/eankuls/.cpan/build/N +et-SSH-Perl-1.37-AUG9Mn/blib/lib/Net/SSH/Perl/Buffer.pm

        As you can see i have added the above path where Buffer.pm lines into @INC, still it is trowing "can't locate" error. got totally confused.. please help

        error: Can't locate Net/SSH/Perl/Buffer.pm in @INC (@INC contains: /home/eank +uls/.cpan/build/Net-SSH-Perl-1.37-AUG9Mn/blib/lib/Net/SSH/Perl /etc/p +erl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/ +perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/l +ocal/lib/site_perl .) at /usr/local/share/perl/5.14.2/Net/SFTP/Buffer +.pm line 6. BEGIN failed--compilation aborted at /usr/local/share/perl/5.14.2/Net/ +SFTP/Buffer.pm line 6. Compilation failed in require at /usr/local/share/perl/5.14.2/Net/SFTP +/Attributes.pm line 7. BEGIN failed--compilation aborted at /usr/local/share/perl/5.14.2/Net/ +SFTP/Attributes.pm line 7. Compilation failed in require at /usr/local/share/perl/5.14.2/Net/SFTP +.pm line 8. BEGIN failed--compilation aborted at /usr/local/share/perl/5.14.2/Net/ +SFTP.pm line 8. Compilation failed in require at ankur_ftp.pl line 9. BEGIN failed--compilation aborted at ankur_ftp.pl line 9.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1084255]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-24 22:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found