我在google搜索时在freebsd服务器上安装任何perl模块时出现此错误我发现cpan已损坏然后如何更新cpan而不使用端口只想使用pkg ..
cpan JSON
Going to read '/root/.cpan/Metadata'
Database was generated on Tue, 04 Oct 2016 19:17:02 GMT
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.
DONE
Going to read '/root/.cpan/sources/modules/03modlist.data.gz'
Can't locate object method "data" via package "CPAN::Modulelist" (perhaps you forgot to load "CPAN::Modulelist"?) at (eval 28) line 1.
at /usr/local/lib/perl5/5.14.2/CPAN/Index.pm line 524
CPAN::Index::rd_modlist('CPAN::Index', '/root/.cpan/sources/modules/03modlist.data.gz') called at /usr/local/lib/perl5/5.14.2/CPAN/Index.pm line 85
CPAN::Index::reload('CPAN::Index') called at /usr/local/lib/perl5/5.14.2/CPAN.pm line 975
CPAN::exists('CPAN=HASH(0x8021b7570)', 'CPAN::Module', 'JSON') called at /usr/local/lib/perl5/5.14.2/CPAN/Shell.pm line 1255
CPAN::Shell::expandany('CPAN::Shell', 'JSON') called at /usr/local/lib/perl5/5.14.2/CPAN/Shell.pm line 1680
CPAN::Shell::rematein('CPAN::Shell', 'install', 'JSON') called at /usr/local/lib/perl5/5.14.2/CPAN/Shell.pm line 1976
CPAN::Shell::__ANON__('CPAN::Shell', 'JSON') called at /usr/local/lib/perl5/5.14.2/App/Cpan.pm line 459
App::Cpan::__ANON__('JSON') called at /usr/local/lib/perl5/5.14.2/App/Cpan.pm line 468
App::Cpan::_default('ARRAY(0x801060798)', 'HASH(0x8021c1ab0)') called at /usr/local/lib/perl5/5.14.2/App/Cpan.pm line 386
App::Cpan::run('App::Cpan', 'JSON') called at /usr/local/bin/cpan line 11
答案 0 :(得分:2)
我刚试过这个
mv /root/.cpan /root/.cpanbackup
再次使用CPAN它工作正常。