Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CPAN giving all sorts of errors on ubuntu

I am just trying to run a simple perl program to import data from xml and export it to database.

Use Mysql; did not work, so I used DBD::mysql instead after failing to get Mysql.pm from cpan.

However, I am unable to install anything. I am trying to install xml parser module, but cpan gives these errors no matter what module you try to install.

install xml::parser
CPAN: Storable loaded ok (v2.20)
Going to read '/root/.cpan/sources/authors/01mailrc.txt.gz'
CPAN: Compress::Zlib loaded ok (v2.02)
............................................................................DONE
Going to read '/root/.cpan/sources/modules/02packages.details.txt.gz'
Warning: Your /root/.cpan/sources/modules/02packages.details.txt.gz does 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.
CPAN: Time::HiRes loaded ok (v1.9719)
Warning: Your /root/.cpan/sources/modules/02packages.details.txt.gz does 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.
DONE
Going to read '/root/.cpan/sources/modules/03modlist.data.gz'
Catching error: "Can't locate object method \"data\" via package \"CPAN::Modulelist\" (perhaps you forgot to load \"CPAN::Modulelist\"?) at (eval 29) line 1.\cJ at /usr/share/perl/5.10/CPAN/Index.pm line 518\cJ\cICPAN::Index::rd_modlist('CPAN::Index', '/root/.cpan/sources/modules/03modlist.data.gz') called at /usr/share/perl/5.10/CPAN/Index.pm line 85\cJ\cICPAN::Index::reload('CPAN::Index') called at /usr/share/perl/5.10/CPAN.pm line 955\cJ\cICPAN::exists('CPAN=HASH(0xa225610)', 'CPAN::Module', 'xml::parser') called at /usr/share/perl/5.10/CPAN/Shell.pm line 1243\cJ\cICPAN::Shell::expandany('CPAN::Shell', 'xml::parser') called at /usr/share/perl/5.10/CPAN/Shell.pm line 1639\cJ\cICPAN::Shell::rematein('CPAN::Shell', 'install', 'xml::parser') called at /usr/share/perl/5.10/CPAN/Shell.pm line 1935\cJ\cICPAN::Shell::__ANON__('CPAN::Shell', 'xml::parser') called at /usr/share/perl/5.10/CPAN.pm line 375\cJ\cIeval {...} called at /usr/share/perl/5.10/CPAN.pm line 372\cJ\cICPAN::shell() called at /usr/bin/cpan line 198\cJ" at /usr/share/perl/5.10/CPAN.pm line 391
    CPAN::shell() called at /usr/bin/cpan line 198
Going to read '/root/.cpan/sources/authors/01mailrc.txt.gz'
............................................................................DONE
Going to read '/root/.cpan/sources/modules/02packages.details.txt.gz'
Warning: Your /root/.cpan/sources/modules/02packages.details.txt.gz does 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 does 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.
cpanDONE
Going to read '/root/.cpan/sources/modules/03modlist.data.gz'
No history written (no histfile specified).
Lockfile removed.
Can't locate object method "data" via package "CPAN::Modulelist" (perhaps you forgot to load "CPAN::Modulelist"?) at (eval 31) line 1.
 at /usr/share/perl/5.10/CPAN/Index.pm line 518
    CPAN::Index::rd_modlist('CPAN::Index', '/root/.cpan/sources/modules/03modlist.data.gz') called at /usr/share/perl/5.10/CPAN/Index.pm line 85
    CPAN::Index::reload('CPAN::Index') called at /usr/share/perl/5.10/CPAN.pm line 692
    CPAN::all_objects('CPAN=HASH(0xa225610)', 'CPAN::Distribution') called at /usr/share/perl/5.10/CPAN/Shell.pm line 1046
    CPAN::Shell::failed('CPAN::Shell', 2, 1) called at /usr/share/perl/5.10/CPAN.pm line 413
    eval {...} called at /usr/share/perl/5.10/CPAN.pm line 413
  CPAN::shell() called at /usr/bin/cpan line 198

Am I doing something wrong? I tried searching for these errors, but no one has a right solution. Is there some setting in the config I should change?

like image 604
roymustang86 Avatar asked Jul 29 '11 16:07

roymustang86


4 Answers

If nobody has an answer for your particular problem I would probably just try with a new cpan, something like:

cd && mv .cpan .cpan-bak

and then trying to install the module again.

Hope this helps.

like image 197
Arjuna Del Toso Avatar answered Nov 15 '22 23:11

Arjuna Del Toso


I had a similar problem.

Situation:

trying to install Catalyst::Plugin::AutoCRUD

using perl version: perlbrew-5.14.2

solution:

problem was the sudo i was prefacing to the cpan install command like this:

DIDNT WORK:

sudo cpan Catalyst::Plugin::AutoCRUD

WORKS:

chown -R myusername:myusergroup ~/.cpan
cpan Catalyst::Plugin::AutoCRUD

Reason: because i had perlbrew + cpan installed under my user account, NOT as root, all subsequent cpan module installs must be made with same user.

like image 44
Flow Avatar answered Nov 15 '22 23:11

Flow


I had the same problem when my connection to the perl site timed out. The /root/.cpan/sources/modules/02packages.details.txt.gz contained only the information that the network timed out, and the /root/.cpan/sources/modules/03modlist.data.gz was also junk.

By removing just these files and trying again when the network was less busy, the files were then fetched correctly and everything worked fine again.

like image 3
Bopper Avatar answered Nov 15 '22 22:11

Bopper


Check that your version of "cpan" (your installation program) matches your "perl" version...

Check this by doing: cpan --version and perl -v

I came across this same error while trying to install another module and it turned out that the version of "cpan" that I was using was compiled as part of the 5.8.8 perl package but the version of "perl" that is set as default here at work is version 5.8.5, so cpan was compiling the C code using references to the wrong 5.8.8 perl base library that was not compatible when implemented by the 5.8.5 perl base.

The simple solution was to call the proper "cpan" program using the full path "/usr/.../perl/5.8.5/bin/cpan module_name".

This little inconsistency of having different binaries of different version packages being default is a an oversight by our administrators and has really caused a lot of grief.

like image 2
Damian Green Avatar answered Nov 15 '22 21:11

Damian Green