cpan安装及其使用
cpan安装及其使用
Perl是一种相当灵活的程序编程语言,现有的许有程序都是使用它进行编程的。它的优点之一就是无需自己编写编码,你就能利用许多增加的模块,创建新的功能。
虽然许多Linux零售商创建了各种Perl模块的RPM软件包,但他们并不为每一个现存的模块创建数据包,除了那些是供应商所要求的。这就是Comprehensive Perl Archive Network (CPAN)的产生的原因。
使用CPAN模块,你就能使用Perl本身安装其它模块。这样做,你就需要你所要安装的模块的名字。比如,你要安装的是Time::HiRes或是DBI模块。具有特色的是,如果你为一个特定的Perl程序查看README文件,它将会列举任何所要求的模块的名字。
第一: 安装:
使用CPAN,成为根用户,执行以下操作:
# perl -MCPAN -e shell
首次这样做的话,你就必须配置CPAN模块。花一些时间按照提示回答它所问的问题;网上通常有这样的例子,通常情况下,问题按住【Enter】就可。这里是说通常情况下,最好自己设置一下!
*************************************************************************************************************
第二:重新设置:
如果在初始安装完成以后,您再想修改某些设置,可以通过以下两种方法进行设置:
方法1:shell下输入cpan,然后回车,cpan[1]> o conf init,会出现一下内容:
CPAN is the world-wide archive of perl resources. It consists of about
300 sites that all replicate the same contents around the globe. Many
countries have at least one CPAN site already. The resources found on
CPAN are easily accessible with the CPAN.pm module. If you want to use
CPAN.pm, lots of things have to be configured. Fortunately, most of
them can be determined automatically. If you prefer the automatic
configuration, answer 'yes' below.
If you prefer to enter a dialog instead, you can answer 'no' to this
question and I'll let you configure in small steps one thing after the
other. (Note: you can revisit this dialog anytime later by typing 'o
conf init' at the cpan prompt.)
Would you like me to configure as much as possible automatically? [yes]
默认的[yes],系统自动的进行编译修改。当然,您可以输入no,回车,然后一项一项的修改。
方法2:修改cpan里面的Config.pm文件
寻找文件:
[root@localhost ]# find / -name Config.pm
/home/.Trash/perl_moduals/perl-5.10.0/ext/Encode/lib/Encode/Config.pm
/home/soft/perl_moduals/perl-5.10.0/ext/Encode/lib/Encode/Config.pm
/usr/lib/perl5/5.8.8/Net/Config.pm
/usr/lib/perl5/5.8.8/ExtUtils/MakeMaker/Config.pm
/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/Config.pm
/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/Encode/Config.pm
/usr/share/automake-1.9/Automake/Config.pm
/usr/local/perl/lib/5.10.0/Net/Config.pm
/usr/local/perl/lib/5.10.0/x86_64-linux/Config.pm
/usr/local/perl/lib/5.10.0/x86_64-linux/Encode/Config.pm
/usr/local/perl/lib/5.10.0/Log/Message/Config.pm
/usr/local/perl/lib/5.10.0/ExtUtils/MakeMaker/Config.pm
/usr/local/perl/lib/5.10.0/Module/Build/Config.pm
/usr/local/perl/lib/5.10.0/CPANPLUS/Config.pm
/usr/local/perl/lib/5.10.0/CPAN/Config.pm
/usr/local/perl/lib/site_perl/5.10.0/HTTP/Config.pm
然后 vi /usr/local/perl/lib/5.10.0/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
# /root/.cpan/CPAN/MyConfig.pm.
$CPAN::Config = {
'applypatch' => q[],
'auto_commit' => q[0],
'build_cache' => q[100],
'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],
'connect_to_internet_ok' => q[1],
'cpan_home' => q[/root/.cpan],
'curl' => q[/usr/bin/curl],
'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],
'halt_on_failure' => q[0],
'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[],
"/usr/local/perl/lib/5.10.0/CPAN/Config.pm" 75L, 2216C
然后修改,保存,退出!
********************************************************************************************************************
第三:使用cpan查询和安装模块(一定在根目录下)
查询:cpan[1]> d /模块名字或者部分名字/
查询结果中会给出所有含有模块名字或者部分名字的模块,选择您所需要的模块进行下载
下载安装:cpan[1]> install 模块名字
所有的模块都可以按照上面的例子,类似的进行安装!
cpan安装及其使用的更多相关文章
- centos环境下使用CPAN安装perl模块
首先安装CPAN yum install perl-CPAN 进入cpan环境 perl -MCPAN -e shell 安装模块(以Tk为例) cpan>install Tk 退出 cpan& ...
- cpan安装报错Invalid host name on line 1 at *FirstTime.pm line 1857.
今天鼓捣一下CPAN,安装时出错: root@ubuntu:~# cpan install DBI CPAN.pm requires configuration, but most of it can ...
- 修改CPAN安装源
更新CPAN镜像源的方法,以CentOS 6.5为例. 存储CPAN设置信息的文件路径为: /usr/share/perl/CPAN/Config.pm 使用vi打开文件 vi /usr/share/ ...
- Linux下安装与使用本地的perl模块
转自 http://www.cnblogs.com/xianghang123/archive/2012/08/23/2652806.html Linux下安装与使用本地的perl模块 在使用Linux ...
- Perl模块的安装方法
1. 下载离线安装包 *.tar.gz的形式解包后,#perl Makefile.PL#make#make install 2. 在联网的情况下,通过CPAN安装# perl -MCPAN -e sh ...
- 四月二十五日,bugzilla for CentOS 安装
Bugzilla for CentOS 5.4 制作人,陈浩 时间:2014.4.25 原创 文件夹 Bugzilla for CentOS 5.4 一. 装系统 1) 新建虚拟机 15G硬盘,51 ...
- 安装centreon
Centreon + nagios + ndoutils 安装 2013-09-25 19:42:44 标签:centreon 原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者 ...
- pt-query-digest 安装及使用
打个草稿 介绍:pt-query-digest 可用于mysql的慢查询的日志分析,分析统计出每种慢查询的基本信息,如响应时间.最大执行时间.最小执行时间.执行时间的中位数等.(当然不只是这个功能) ...
- centos7 cpanm安装,及perl模块安装
1. cpan安装 yum安装 yum install perl-App-cpanminus.noarch 注意:安装完成后,root及非root用户都可以使用cpanm安装模块,root用户直接用c ...
随机推荐
- jQuery 1.9不支持$.browser 怎么判断浏览器类型和版本
$.browser.mozilla = /firefox/.test(navigator.userAgent.toLowerCase());$.browser.webkit = /webkit/.te ...
- python模块—urllib
1. 网页操作 urllib.urlopen(url[,data[,proxies]]) 打开一个url,返回一个文件对象,然后可以进行类似文件对象操作 url:远程数据的路径,即网址 data:表示 ...
- Hash算法原理理解
我们有很多的小猪,每个的体重都不一样,假设体重分布比较平均(我们考虑到公斤级别),我们按照体重来分,划分成100个小猪圈. 然后把每个小猪,按照体重赶进各自的猪圈里,记录档案. 好了,如果我们要找某个 ...
- 让vs2010的html编辑器验证html5语法
或者在Tools -> option -> Text Editor -> Html -> Validation
- html中上标、下标、删除字、小号字等
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- Enabling Process Accounting on Linux HOWTO
http://tldp.org/HOWTO/Process-Accounting/index.html
- 微软Windows 7 “可启动U盘”制作工具及使用方法,非常的简单
目前,用“可启动U盘”替代光驱光盘安装操作系统,已经成为一种时尚(至少对没有刻录机或不愿购买光碟的群体是这样).制作“可启动U盘”的方法和工具很多,区别无非是制作的难易程度和对“U盘类型”的支持程度. ...
- Make Hadoop 1.2.1 run, my first try
经历两天努力,8月25日下午2点40分,终于让hadoop1.2.1跑起来. 用的是<Hadoop实战第2版>(陆嘉恒)里面的WordCount例子,虽然书是2013年出的,但用的例子还是 ...
- poj2365---求多边形边长总和
#include <stdio.h> #include <stdlib.h> #include<math.h> #define pi acos(-1) struct ...
- 魔兽世界---屠夫(Just a Hook)
Just a Hook Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Tota ...