今天用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
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 http://www.perl.com/CPAN/
cpan> o conf commit
然後再執行上面的reload index之後的步驟就OK了。