Solved

Linux Perl Error

Posted on 2012-03-20
4
1,651 Views
Last Modified: 2012-06-27
I'm trying to install a nagios plugin but i'm getting an error within CPAN.
[root@Opsview libexec]# ./check_vmware_esxi.pl 
Can't locate Try/Tiny.pm in @INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at /usr/lib/perl5/site_perl/5.8.8/Module/Implementation.pm line 10.
BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.8.8/Module/Implementation.pm line 10.
Compilation failed in require at /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/Params/Validate.pm line 12.
BEGIN failed--compilation aborted at /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/Params/Validate.pm line 12.
Compilation failed in require at /usr/lib/perl5/vendor_perl/5.8.8/Nagios/Plugin/Functions.pm line 11.
BEGIN failed--compilation aborted at /usr/lib/perl5/vendor_perl/5.8.8/Nagios/Plugin/Functions.pm line 11.
Compilation failed in require at /usr/lib/perl5/vendor_perl/5.8.8/Nagios/Plugin.pm line 4.
BEGIN failed--compilation aborted at /usr/lib/perl5/vendor_perl/5.8.8/Nagios/Plugin.pm line 4.
Compilation failed in require at ./check_vmware_esxi.pl line 33.
BEGIN failed--compilation aborted at ./check_vmware_esxi.pl line 33.

Open in new window

So then i try and install the Tiny.pm
cpan[1]> install Config::Tiny
Reading '/root/.cpan/Metadata'
  Database was generated on Tue, 20 Mar 2012 06:17:46 GMT
Running install for module 'Config::Tiny'
Running make for A/AD/ADAMK/Config-Tiny-2.14.tar.gz
Fetching with LWP:
http://cpan.knowledgematters.net/authors/id/A/AD/ADAMK/Config-Tiny-2.14.tar.gz
CPAN::LWP::UserAgent->new dies with Can't locate HTTP/Config.pm in @INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 /usr/local/nagios/libexec) at /usr/lib/perl5/site_perl/5.8.8/LWP/UserAgent.pm line 770.

Catching error: "Can't call method \"mirror\" on an undefined value at /usr/lib/perl5/5.8.8/CPAN/FTP.pm line 633.\cJ" at /usr/lib/perl5/5.8.8/CPAN.pm line 392
	CPAN::shell() called at -e line 1

Open in new window

Not sure what to do next....
0
Comment
Question by:c3very
  • 2
  • 2
4 Comments
 
LVL 21

Expert Comment

by:Papertrip
ID: 37745011
Are you running a distro with yum setup?  If you do and have the rpmforge repo, just type
yum install perl-Try-Tiny

Open in new window


FYI Config::Tiny is a different module than what the error is saying.

[root@broken ~]# yum info perl-Try-Tiny
Loaded plugins: fastestmirror, presto, priorities
Loading mirror speeds from cached hostfile
 * base: mirrors.kernel.org
 * epel: mirrors.kernel.org
 * extras: mirrors.cat.pdx.edu
 * rpmforge: apt.sw.be
 * updates: ftp.osuosl.org
85 packages excluded due to repository priority protections
Available Packages
Name        : perl-Try-Tiny
Arch        : noarch
Version     : 0.09
Release     : 1.el6.rf
Size        : 18 k
Repo        : rpmforge
Summary     : minimal try/catch with proper localization of $@
URL         : http://search.cpan.org/dist/Try-Tiny/
License     : Artistic/GPL
Description : This module provides bare bones try/catch statements that are designed to
            : minimize common mistakes with eval blocks, and NOTHING else.
            :
            : This is unlike TryCatch which provides a nice syntax and avoids adding another
            : call stack layer, and supports calling return from the try block to return from
            : the parent subroutine. These extra features come at a cost of a few
            : dependencies, namely Devel::Declare and Scope::Upper which are occasionally
            : problematic, and the additional catch filtering uses Moose type constraints
            : which may not be desirable either.
            :
            : The main focus of this module is to provide simple and reliable error handling
            : for those having a hard time installing TryCatch, but who still want to write
            : correct eval blocks without 5 lines of boilerplate each time.
            :
            : It's designed to work as correctly as possible in light of the various
            : pathological edge cases (see BACKGROUND) and to be compatible with any style of
            : error values (simple strings, references, objects, overloaded objects, etc).
0
 
LVL 2

Author Comment

by:c3very
ID: 37745053
i do have yum setup.

[root@Opsview ~]# yum install perl-Try-Tiny
.......
Running Transaction
  Installing     : perl-Try-Tiny                                                                                                  1/1 

Installed:
  perl-Try-Tiny.noarch 0:0.09-1.el5.rf                                                                                                

Complete!

Open in new window


I don't know if this is necessary but i went back into CPAN to install Config::Tiny but i still get an error.
cpan[1]> install Config::Tiny
Reading '/root/.cpan/Metadata'
  Database was generated on Tue, 20 Mar 2012 06:17:46 GMT
Running install for module 'Config::Tiny'
Running make for A/AD/ADAMK/Config-Tiny-2.14.tar.gz
Fetching with LWP:
http://cpan.knowledgematters.net/authors/id/A/AD/ADAMK/Config-Tiny-2.14.tar.gz
CPAN::LWP::UserAgent->new dies with Can't locate HTTP/Config.pm in @INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 /root) at /usr/lib/perl5/site_perl/5.8.8/LWP/UserAgent.pm line 770.

Catching error: "Can't call method \"mirror\" on an undefined value at /usr/lib/perl5/5.8.8/CPAN/FTP.pm line 633.\cJ" at /usr/lib/perl5/5.8.8/CPAN.pm line 392
	CPAN::shell() called at -e line 1

Open in new window

0
 
LVL 21

Accepted Solution

by:
Papertrip earned 500 total points
ID: 37745078
Don't bother with Config::Tiny unless your script fails due to it not being there.  If that happens then just yum install perl-Config-Tiny

Does your script work now?
0
 
LVL 2

Author Closing Comment

by:c3very
ID: 37745142
Ok, that seemed to work.  Just running the script without an arguments returns the correct response.  I'll have to open another question to troubleshoot the error i'm getting with args.
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now