5

I am running a perl script that uses SSH, but it prints the following error:

Can't locate Net/SSH/Perl.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at newone.pl line 3. BEGIN failed--compilation aborted at newone.pl line 3.

Perl can't seem to locate Net/SSH/Perl.pm. Why can't it find it and how do I install it?

Eric Leschinski
  • 135,913
  • 89
  • 401
  • 325
Hellos
  • 571
  • 2
  • 5
  • 4

2 Answers2

8

Your code is fine, although I haven't checked it as the error is due to a missing perl module.

What's the easiest way to install a missing Perl module?

Community
  • 1
  • 1
Bruce
  • 1,532
  • 13
  • 17
2

You need to install and/or include the appropriate SSH library for perl. You can install it using this command:

cpan install Net::SSH::Perl

user1118321
  • 24,739
  • 4
  • 55
  • 82
Alex
  • 21
  • 1
  • I had to include the `-f` flag: `cpan -f install Net::SSH::Perl` to force the command since there were test errors on my machine. Be prepared to wait 10 minutes for this command to complete. – Eric Leschinski Dec 21 '14 at 17:43