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 ...
随机推荐
- Mysql动态多条件查询
动态多条件查询是一类经常遇到的问题. 在Mysql里面可以用语句简单的解决. SELECT * FROM product WHERE price = IF('{0}' = '', price, '{0 ...
- Linux网络管理——远程登录工具
4. 远程登录工具 .note-content {font-family: "Helvetica Neue",Arial,"Hiragino Sans GB", ...
- js 获取月份 格式yy-mm-dd
/** * 获取上一个月 * * @date 格式为yyyy-mm-dd的日期,如:2014-01-25 */ function getPreMonth(date) { var arr = date. ...
- ACM大数模板(支持正负整数)
之前就保留过简陋的几个用外部数组变量实现的简单大数模板,也没有怎么用过,今天就想着整合封装一下,封装成C++的类,以后需要调用的时候也方便得多. 实现了基本的加减乘除和取模运算的操作符重载,大数除以大 ...
- Delphi 的接口机制——接口操作的编译器实现过程(2)
接口对象的内存空间 假设我们定义了如下两个接口 IIntfA 和 IIntfB,其中 ProcA 和 ProcB 将实现为静态方法,而 VirtA 和 VirtB 将以虚方法实现: IIntfA = ...
- visual leak dector内存泄漏检测方法
http://vld.codeplex.com/ QT 内存泄露时,你们一般用什么工具检测啊 ------解决方案--------------------这篇你觉得详细么 :http://newfac ...
- nginx 通过rsyslog发日志 rsyslog服务器挂掉 日志丢失问题
nginx 配置: user nginx; worker_processes 1; syslog local5 nginx-zjzc01; rsyslog 服务器收到的消息: -rw-r--r-- 1 ...
- IE6兼容性问题及IE6常见bug详细汇总---转载
1.IE6怪异解析之padding与border算入宽高 原因:未加文档声明造成非盒模型解析 解决方法:加入文档声明<!doctype html> 2.IE6在块元素.左右浮动.设定mar ...
- saiku安装方法总结
最近研究pentaho和saiku,在网上搜集了一些安装和配置的方法,亲测有效,在这分享总结一下方便日后使用. Saiku主要提供两种安装方式,独立运行和集成在Pentaho BI平台上,本文会简单介 ...
- lighttpd配置虚拟主机/php等WEB环境
lighttpd(1.4.37)配置如下 server.document-root = "/var/www/lighttpd/" server.port = 8888 server ...