转载:http://hi.baidu.com/kouzl/blog/item/a73c281005813804203f2e37.html
方法一:
首先删除了cpan的配置文件及相关的软件
[root@www ~]# cd /usr/lib/perl5/5.8.8/CPAN/
[root@ww CPAN]# rm Config.pm
[root@www ~]# cd /root/.cpan (这个目录是在一开始以ROOT的账号初始化cpan时创建的)
[root@www .cpan]# rm -rf *
然后手动编译配置文件Config.pm
[root@www ~]vi /usr/lib/perl5/5.8.8/CPAN/Config.pm
# This is CPAN.pm's systemwide configuration file. This file provides
# defaults for users, and the values can be changed in a per-user
# configuration file. The user-config file is being looked for as
# ~/.cpan/CPAN/MyConfig.pm.
$CPAN::Config = {
'build_cache' => q[10],
'build_dir' => q[/root/.cpan/build],
'cache_metadata' => q[1],
'commandnumber_in_prompt' => q[1],
'cpan_home' => q[/root/.cpan],
'dontload_hash' => { },
'ftp' => q[/usr/kerberos/bin/ftp],
'ftp_passive' => q[1],
'ftp_proxy' => q[],
'getcwd' => q[cwd],
'gpg' => q[/usr/bin/gpg],
'gzip' => q[/bin/gzip],
'histfile' => q[/root/.cpan/histfile],
'histsize' => q[100],
'http_proxy' => q[],
'inactivity_timeout' => q[0],
'index_expire' => q[1],
'inhibit_startup_message' => q[0],
'keep_source_where' => q[/root/.cpan/sources],
'make' => q[/usr/bin/make],
'make_arg' => q[],
'make_install_arg' => q[],
'make_install_make_command' => q[/usr/bin/make],
'makepl_arg' => q[],
'mbuild_arg' => q[],
'mbuild_install_arg' => q[],
'mbuild_install_build_command' => q[./Build],
'mbuildpl_arg' => q[],
'ncftp' => q[],
'ncftpget' => q[],
'no_proxy' => q[],
'pager' => q[/usr/bin/less],
'prerequisites_policy' => q[ask],
'scan_cache' => q[atstart],
'shell' => q[/bin/bash],
'tar' => q[/bin/tar],
'term_is_latin' => q[1],
'term_ornaments' => q[1],
'unzip' => q[/usr/bin/unzip],
'urllist' => [q[http://cpan.linuxforum.net/]],
'wget' => q[/usr/bin/wget],
};
1;
__END__
方法二:
如要重新配置CPAN,可先进入CPAN
[root@www ~]# perl -MCPAN -e shell
然后在CPAN命令行(即CPAN>)键入以下指令:
CPAN>o conf init
然后在下面的各个询问中可以改已经配置好的选项
如我修改了urllist那如果想在安装的时候从修改过的urllist中取相关的模块,需要执行下面的命令用来更新相关的资料
CPAN>reload index
CPAN>reload cpan