mvip has asked for the wisdom of the Perl Monks concerning the following question:

Im trying to install Net::SNMP on Ubuntu Server 12.04 with the following command:

perl -MCPAN -e 'install Net::SNMP'

Also i was trying this "cpan> install Net::SNMP" and "install Bundle::CPAN"

And have the following errors:

Going to read '/root/.cpan/sources/authors/01mailrc.txt.gz' DONE Fetching with HTTP::Tiny: http://artfiles.org/cpan.org/modules/02packages.details.txt.gz Going to read '/root/.cpan/sources/modules/02packages.details.txt.gz' Warning: Your /root/.cpan/sources/modules/02packages.details.txt.gz do +es not contain a Line-Count header. Please check the validity of the index file by comparing it to more than one CPAN mirror. I'll continue but problems seem likely to happen. Warning: Your /root/.cpan/sources/modules/02packages.details.txt.gz do +es not contain a Last-Updated header. Please check the validity of the index file by comparing it to more than one CPAN mirror. I'll continue but problems seem likely to happen. Could not split line["<html>"] Could not split line["\cI<head>"] .Could not split line["\cI\cI"] Could not split line[""] Giving up parsing your /root/.cpan/sources/modules/02packages.details. +txt.gz, too many errors root@start:/usr/local/nagios/libexec# aptitude -y install snmp No packages will be installed, upgraded, or removed. 0 packages upgraded, 0 newly installed, 0 to remove and 1 not upgraded +. Need to get 0 B of archives. After unpacking 0 B will be used.

Replies are listed 'Best First'.
Re: install CPAN modules
by marto (Cardinal) on Sep 30, 2013 at 09:44 UTC

    Exit the cpan shell, move the existing .cpan directory to a backup:

    mv /root/.cpan /root/.cpanbackup

    Restart the cpan shell and try again. Also in Ubuntu package management you're looking for libnet-snmp-perl.

    Update: As a side note you may consider installing your own perl elsewhere, and leaving the system perl to the OS. You can easily install perl elsewhere as per the installation instructions, or perlbrew.

Re: install CPAN modules
by jellisii2 (Hermit) on Sep 30, 2013 at 12:01 UTC
    Have you ensured it's not already installed? On my mostly unmolested VMs running 12.04, perldoc Net::SMTP returns documentation.

    This assumes that the prepacked version does everything you need, of course.

      Hi, tnx for reply. When i run the perldoc command i have the following:

      root@mpnagios:/# perldoc Net::SMTP You need to install the perl-doc package to use this program. root@mpnagios:/#
      But when i run the perl -v it gave me the output what version is perl. So perl is installed and i dont knwo way CPAN dont work ...

        This is telling you to install perl-doc to use the program perldoc on your system. To do this:

        apt-get install perl-doc

        Or better still read and understand the answer I gave you, or better yet speak to your systems administrator.

        marto gave you the correct answer above.

        I also noticed you are already using aptitude. So do a

        aptitude -y install perl-doc

        ...to get it installed the way you know.

        Cheers, Sören

        Créateur des bugs mobiles - let loose once, run everywhere.
        (hooked on the Perl Programming language)

        perl -e "use warnings; use Net::SMTP;"
        If it returns nothing, you have it installed.
Re: install CPAN modules
by blue_cowdawg (Monsignor) on Sep 30, 2013 at 14:24 UTC

    One thought: on Linux boxen I'm quite often tempted to use the packaged versions of Perl modules that most distros have out there these days. This is in line with the oft suggested strategy of "leaving the OS Perl alone" which I don't always subscribe to.

    There are two ways, however, that you can get burned by using the version or a Perl module that a distro will support:

    1. Debian in particular and CentOS annoyingly so are quite often behind in the rev of things that they support. A non-Perl example is Blender which on Ubuntu (a Debian derivative) loads and supports version 2.61 (I think), Linux Mint (2.67) which is "too old" to do the kinds of things I want to do with Blender. I've also seen Perl modules load in those that are out of date but I just don't remember which ones.
    2. Given that those modules can be back-reved if there are bug fixes, feature enhancements or whatever you can experience unexpected behaviors that were "fixed" a while back.

    Payback? I use Puppet to manage software loads on my machines. Being able to ensure that Mime::Lite is loaded (or any other module) is a great thing. Trying to add a package provider for cpanm or 'perl -mCPAN' would require me learning Ruby which I don't really want to do.


    Peter L. Berghold -- Unix Professional
    Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg
Re: install CPAN modules
by Pizentios (Scribe) on Sep 30, 2013 at 14:56 UTC

    When i started my current job, we were a mainly debian shop. However because of issues like this we have since started moving away from debian. It's not only because of outdated perl libs, but outdated system libs that make it difficult to install things like Net::SNMP even into a perlbrew environment.

    I am a big believer in leaving the system perl alone, because i have had to personally fix a messed up system twice and re-install another one because myself or some other admin updated the system's perl libs. So using the perl libs in the system's package system just isn't a option for me.

    And yes, Net::SNMP is definatly a lib/package that i have experienced problems installing on debian systems because of outdated system libs. Interestingly enough, the lib installed just fine on my Ubuntu 13.04 desktop (into my perl brew install). Maybe a system upgrade is in order?

    -Pizentios