Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Linux Perl Error

Posted on 2012-03-20
4
1,694 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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

808 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