perl 配置perl依赖库文件安装源

1)配置文件:  /usr/lib/perl5/5.8.8/CPAN/Config.pm
如果第一次运行cpan命令
cpan提示进行交互的进行配置
当然我们根据自己的需要也可以手动的编辑此文件

贴一下自己的配置:

# 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],
  'cpan_home' => q[/root/.cpan],
  'dontload_hash' => {  },
  'ftp' => q[/usr/kerberos/bin/ftp],
  'ftp_proxy' => q[],
  'getcwd' => q[cwd],
  'gpg' => q[/usr/bin/gpg],
  'gzip' => q[/usr/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],
  'links' => q[/usr/bin/links],
  'make' => q[/usr/bin/make],
  'make_arg' => q[],
  'make_install_arg' => q[],
  'makepl_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],
  'unzip' => q[/usr/bin/unzip],
  'urllist' => [q[http://cpan.modperl.cn/]],
  'wget' => q[/usr/bin/wget],
};
1;
__END__


2)如果需要重新配置CPAN,输入:
#cpan
进入cpan后,输入:
#CPAN>o conf init

重新配置后Config.pm如下:

$CPAN::Config = {
  'applypatch' => q[],
  'auto_commit' => q[0],
  'build_cache' => q[10],
  'build_dir' => q[/root/.cpan/build],
  'build_dir_reuse' => q[1],
  'build_requires_install_policy' => q[ask/yes],
  'bzip2' => q[/usr/bin/bzip2],
  'cache_metadata' => q[1],
  'check_sigs' => q[0],
  'colorize_output' => q[0],
  'commandnumber_in_prompt' => q[1],
  'cpan_home' => q[/root/.cpan],
  'curl' => q[/usr/bin/curl],
  '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[/usr/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],
  'load_module_verbosity' => q[v],
  'lynx' => q[],
  '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],
  'patch' => q[/usr/bin/patch],
  'prefer_installer' => q[MB],
  'prefs_dir' => q[/root/.cpan/prefs],
  'prerequisites_policy' => q[ask],
  'scan_cache' => q[atstart],
  'shell' => q[/bin/bash],
  'show_unparsable_versions' => q[0],
  'show_upload_date' => q[0],
  'show_zero_versions' => q[0],
  'tar' => q[/bin/tar],
  'tar_verbosity' => q[v],
  'term_is_latin' => q[1],
  'term_ornaments' => q[1],
  'test_report' => q[0],
  'unzip' => q[/usr/bin/unzip],
  'urllist' => [q[http://cpan.modperl.cn/]],
  'use_sqlite' => q[0],
  'wget' => q[/usr/bin/wget],
  'yaml_load_code' => q[0],
  'yaml_module' => q[YAML],
};
1;
__END__


3)安装perl组件出错:

/usr/bin/make — NOT OK
Running make test
Can’t test without successful make
Running make install
make had returned bad status, install seems impossible

一.可以尝试

#cpan
cpan>o conf make /usr/bin/make
cpan>o conf commit
cpan>exit
然后用perl命令再安装一下该组件,看能否成功。

 

cpan

查看镜像列表:

cpan[1]>o conf urllist
    urllist           
    0 [http://httpupdate3.cpanel.net/CPAN/]
    1 [http://httpupdate23.cpanel.net/CPAN/]
    2 [http://mirrors.servercentral.net/CPAN/]
    3 [ftp://cpan.cse.msu.edu/]

增加列表

cpan[2]> o conf urllist push http://mirror.waia.asn.au/pub/cpan/

Remove a CPAN mirror

To remove a CPAN mirror use the “shift” or “pop” functions to remove the mirror URL from the front or end of the mirror list:

cpan[3]> o conf urllist pop

Completely replace the existing mirror list

To overwrite the existing mirror list with a new one, just provide the URLs to the new mirrors as a space separated list:

cpan[4]> o conf urllist http://mirror.waia.asn.au/pub/cpan/ ftp://mirrors.coopvgg.com.ar/CPAN/

Saving changes

Once you have updated the CPAN mirror list, make sure you commit the changes to file so they are saved beyond the current session:

cpan[5]> o conf commit
commit: wrote '/home/sillymoose/.cpan/CPAN/MyConfig.pm'

Edit the CPAN configuration file directly

You can also edit the CPAN config file directly. For local user Perl installations this is */CPAN/MyConfig.pm and system Perl installations */CPAN/Config.pm (the parent directory will depend on the platform). When editing the file, urllist is a hash key for an array reference of mirror urls. Note the urls are quoted using Perl’s quoting operator (“q”). Simply edit and save the file.

'urllist' => [
    q[http://httpupdate3.cpanel.net/CPAN/], 
    q[http://httpupdate23.cpanel.net/CPAN/], 
    q[http://mirrors.servercentral.net/CPAN/], 
    q[ftp://cpan.cse.msu.edu/]
],

重新配置,如要重新配置CPAN,可先进入CPAN

# perl -MCPAN -e shell
CPAN> o conf init  //在CPAN命令行输入,然后在下面的各个询问中修改各选项
CPAN> reload index  //修改完后通过reload index, reload cpan来更新
CPAN> reload cpan

几个主要的CPAN站点有: 
    国内:

                   http://ftp.cuhk.edu.hk/pub/packages/perl/CPAN/
                   ftp://ftp.cuhk.edu.hk/pub/packages/perl/CPAN/
                   http://mirrors.geoexpat.com/cpan/

                   http://cpan.nctu.edu.tw/

                    
    国外:http://www.cpan.org/



二.原因也可能是默认缓存/root/.cpan中的数据损坏
rm -rf ~/.cpan
删除后在perl -MCPAN -e shell中执行reload index
然后执行install Bundle::CPAN
最后执行reload CPAN即可正常通过命令行install MODULES

 

 

 

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值