Perl CPAN安裝報錯CPAN::Modulelist的解決辦法

denniswwh發表於2009-08-13

今天用CPAN安裝Term::ReadLine,報了個這樣的錯誤

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 31) line 1.
at /usr/lib/perl5/5.8.5/CPAN.pm line 3406
CPAN::Index::rd_modlist('CPAN::Index', '/root/.cpan/sources/modules/03modlist.data.gz') called at /usr/lib/perl5/5.8.5/CPAN.pm line 3129
CPAN::Index::reload('CPAN::Index') called at /usr/lib/perl5/5.8.5/CPAN.pm line 675
CPAN::exists('CPAN=HASH(0x9c79658)', 'CPAN::Module', 'Term::ReadLine') called at /usr/lib/perl5/5.8.5/CPAN.pm line 1842
CPAN::Shell::expandany('CPAN::Shell', 'Term::ReadLine') called at /usr/lib/perl5/5.8.5/CPAN.pm line 2078
CPAN::Shell::rematein('CPAN::Shell', 'install', 'Term::ReadLine') called at /usr/lib/perl5/5.8.5/CPAN.pm line 2165
CPAN::Shell::install('CPAN::Shell', 'Term::ReadLine') called at /usr/lib/perl5/5.8.5/CPAN.pm line 201
eval {...} called at /usr/lib/perl5/5.8.5/CPAN.pm line 201
CPAN::shell() called at -e line 1

[@more@]

google結果有人是這樣解決的

rm -rf ~/.cpan
刪除後在perl -MCPAN -e shell中執行reload index
然後執行install Bundle::CPAN
最後執行reload CPAN即可正常透過命令列install MODULES

我按照這個做,結果reload index執行都報錯,繼續google,發現應該是Config.pm的問題,重新配置

cpan> o conf urllist unshift
cpan> o conf commit

然後再執行上面的reload index之後的步驟就OK了。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/124805/viewspace-1025258/,如需轉載,請註明出處,否則將追究法律責任。

相關文章