新手解决Can't locate CPAN.pm in @INC
执行perl-MCPAN -e shell出错,提示如下:
$perl -MCPAN -e shell
Can'tlocate CPAN.pm in @INC (@INC contains:/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/usr/lib/perl5/site_perl/5.8.7/i386-linux-thread-multi/usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl/5.8.7/usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.5/usr/lib/perl5/site_perl/usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/usr/lib/perl5/vendor_perl/5.8.7/i386-linux-thread-multi/usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi/usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi/usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl/5.8.7/usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.5/usr/lib/perl5/vendor_perl/usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 .).
BEGINfailed--compilation aborted.
到CPAN的官方站点下载CPAN模块
http://search.cpan.org/~andk/CPAN-1.9301/lib/CPAN.pm
解压,编绎,安装
$tar zxvf CPAN-1.9301.tar.gz
$cd CPAN-1.9301
$perl Makefile.PL
ImportingPAUSE public key into your GnuPG keychain... done!
(Youmay wish to trust it locally with 'gpg --lsign-key 450F89EC')
WARNING:SIGN is not a known parameter.
Checkingif your kit is complete...
Looksgood
Warning:prerequisite Test::Harness 2.62 not found. We have 2.56.
Warning:prerequisite Test::More 0 not found.
'SIGN'is not a known MakeMaker parameter name.
WritingMakefile for CPAN
有警告,需要处理一下,开始我没有处理结果后面make出错了。需要2个模块Test::Harness和Test::More,到CPAN查找下载
我使用的是Test-Harness-3.14.tar.gz和Test-Simple-0.84.tar.gz,将它们解压安装(注意,这里需要先安装Test::More模块,我在安装时先安装Test::Harness后使用make test会报错,后安装就不会出问题):
$perl Makefile.PL
$make
$make test
$su
#make install
现在更新了依赖模块,重新尝试安装CPAN:
$perl Makefile.PL
$make
$make test
#make install
成功进入CPAN的shell模式
$perl -MCPAN -e shell
可以自己配置使用了^^。刚接触Perl,对于如何配置不熟悉,直接使用缺省配置