说明:

蓝色字体是终端上输出的文字;

红色字体是我们输入的指令;

先把步骤写上,免得看我下面叙述感到啰嗦:

一 CPAN

$cpan

cpan>install Tkx

???感觉安装很慢,那就配置下

capn>o conf urllist push http://mirrors.163.com/cpan/

上面的那个镜像是国内的,国内还有其他镜像,参考http://blog.csdn.net/q1241580040/article/details/47671873

cpan>o conf commit

得到:commit: wrote '/Users/xxxxxx/.cpan/CPAN/MyConfig.pm'

请看你自己的MyConfig.pm的路径

然后打开.pm文件,找到最后有个urllist=[...]的,

然后可以把那些网址删除,再把国内网站的添加上,保存退出,再次安装模块,再也不需要等待。。。。。

有参考:http://bbs.chinaunix.net/thread-3610007-1-1.html

二 CPANPLUS

使用CPANPLUS的话,就能自动给依赖的模块也装好

cpan>install CPANPLUS

$cpanp

CPAN Terminal>s reconfigure

7> Select mirrors

Section to configure: [1]:7

1> Mirror

Please choose an option [1]:1

2> Asia

Pick a continent [2]:2

1> ftp://ftp.cuhk.edu.hk

2> ftp://mirrors.ustc.edu.cn

3> ftp://mirrors.xmu.edu.cn

4> http://cpan.communilink.net

5> http://ftp.cuhk.edu.hk

6> http://mirrors.163.com

7> http://mirrors.devlib.org

8> http://mirrors.hust.edu.cn

9> http://mirrors.neusoft.edu.cn

10> http://mirrors.sohu.com

11> http://mirrors.ustc.edu.cn

12> http://mirrors.xmu.edu.cn

13> rsync://mirrors.ustc.edu.cn

14> rsync://mirrors.xmu.edu.cn

15> Custom

16> View

17> Up

18> Quit

Please pick a site:  :6 10 8 11

18> Quit

Please pick a site:  :18

9> Save & exit

Section to configure: [1]:

安装模块

CPAN Terminal>i CSS

你没看错就是i+模块名完成~~~~~

详情参看:http://www.php-oa.com/2010/02/04/cpanplus-per.html

如安装完成,就没必要再看下面的啰嗦:

1.CPAN

Mac os下通过CPAN安装第三方模块很方便,只需要:

xxxxxx:~ xxxxx$cpan

Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v2.00)

Enter 'h' for help.

cpan[1]>install [module_name]

。。。。。。。。

但这时你通常感觉安装会很慢甚至卡住一样,最后可能告诉你timeout什么的结束,反正是安装特别不爽。

当我注意到CPAN安装时资源是从国外的镜像上抓取的,参看下面的浅蓝位置:

Fetching with LWP:

http://mirrors.163.com/cpan/authors/id/R/RU/RUBYKAT/SQLite-Work-0.16.tar.gz

这里是http://mirrors.163.com/cpan/,是因为我设置过,通常默认的是国外网站,你可对比下

这时我想起CPAN在中国有很多的镜像网站在上面下载资源很快,那有没有方法直接从中国的镜像下下载呢,然后我就搜了下,参考了:

http://bbs.chinaunix.net/thread-3610007-1-1.html

里面的回答,然后自己设置下:

xxxxx:~ xxxx$cpan

Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v2.00)

Enter 'h' for help.

cpan[1]>o conf help

Known options:

commit    commit session changes to disk

defaults  reload default config values from disk

help      this help

init      enter a dialog to set all or a set of parameters

Edit key values as in the following (the "o" is a literal letter o):

o conf build_cache 15

o conf build_dir "/foo/bar"

o conf urllist shift

o conf urllist unshift ftp://ftp.foo.bar/

o conf inhibit_startup_message 1

cpan[2]>o conf urllist push http://mirrors.163.com/cpan/

Please use 'o conf commit' to make the config permanent!

cpan[3]>o conf commit

commit: wrote '/Users/xxxxxx/.cpan/CPAN/MyConfig.pm'

也看到提示了保存到了我的个人文件夹的config中

再次进入cpan,当你欣喜万千再次安装模块时,可发现还是从原来那个镜像抓取,注意到Myconfig.pm这个文件,然后通过上面提供的路径打开Myconfig.pm,找到最后几行,有个

'urllist' =>......的,会看到刚才加入的163的镜像在最后,而它是默认从第一个镜像使用的,除非前面一个镜像查不到这个模块才会轮到下一个,而这种情况又是极少见的,所以把163的网址,放到第一个就ok了,保存退出,再次安装你会看到安装信息满屏滚动你会心潮澎湃的,哈哈~~~


2.CPANPLUS


因为我曾配置过,所以显示步骤有可能有差异,请自己斟酌

xxxx:~ xxxx$cpanp

CPANPLUS::Shell::Default -- CPAN exploration and module installation (v0.9154)

*** Please report bugs to <bug-cpanplus@rt.cpan.org>.

*** Using CPANPLUS::Backend v0.9154.

*** ReadLine support available (try 'i Term::ReadLine::Perl').

*** Type 'p' now to show start up log

Did you know...

You can run an interactive setup using 's reconfigure'

CPAN Terminal>s reconfigure

=================>      MAIN MENU       <=================

Welcome to the CPANPLUS configuration. Please select which

parts you wish to configure

Defaults are taken from your current configuration.

If you would save now, your settings would be written to:

CPANPLUS::Config::User

1> Select Configuration file

2> Setup CLI Programs

3> Setup CPANPLUS Home directory

4> Setup FTP/Email settings

5> Setup basic preferences

6> Setup installer settings

7> Select mirrors

8> Edit configuration file

9> Save & exit

10> Quit without saving

Section to configure: [1]:7

You can select VIEW to see your current selection and QUIT when you

are done.

1> Mirror

2> Custom

3> View

4> Quit

Please choose an option [1]:1

Now, we are going to fetch the mirror list for first-time configurations.

This may take a while...

1> Africa

2> Asia

3> Europe

4> North America

5> Oceania

6> South America

7> Custom

8> Up

9> Quit

Pick a continent [2]:2

You can enter multiple sites by separating them by a space.

For example:

1 4 2 5

1> ftp://ftp.cuhk.edu.hk

2> ftp://mirrors.ustc.edu.cn

3> ftp://mirrors.xmu.edu.cn

4> http://cpan.communilink.net

5> http://ftp.cuhk.edu.hk

6> http://mirrors.163.com

7> http://mirrors.devlib.org

8> http://mirrors.hust.edu.cn

9> http://mirrors.neusoft.edu.cn

10> http://mirrors.sohu.com

11> http://mirrors.ustc.edu.cn

12> http://mirrors.xmu.edu.cn

13> rsync://mirrors.ustc.edu.cn

14> rsync://mirrors.xmu.edu.cn

15> Custom

16> View

17> Up

18> Quit

Please pick a site:  :6 10 8 11

Selected http://mirrors.163.com              0 hosts selected thus far.

Selected http://mirrors.sohu.com             0 hosts selected thus far.

Selected http://mirrors.hust.edu.cn          0 hosts selected thus far.

Selected http://mirrors.ustc.edu.cn          0 hosts selected thus far.

You can enter multiple sites by separating them by a space.

For example:

1 4 2 5

1> ftp://ftp.cuhk.edu.hk

2> ftp://mirrors.ustc.edu.cn

3> ftp://mirrors.xmu.edu.cn

4> http://cpan.communilink.net

5> http://ftp.cuhk.edu.hk

6> http://mirrors.163.com

7> http://mirrors.devlib.org

8> http://mirrors.hust.edu.cn

9> http://mirrors.neusoft.edu.cn

10> http://mirrors.sohu.com

11> http://mirrors.ustc.edu.cn

12> http://mirrors.xmu.edu.cn

13> rsync://mirrors.ustc.edu.cn

14> rsync://mirrors.xmu.edu.cn

15> Custom

16> View

17> Up

18> Quit

Please pick a site:  :18

Your host configuration has been saved

=================>      MAIN MENU       <=================

Welcome to the CPANPLUS configuration. Please select which

parts you wish to configure

Defaults are taken from your current configuration.

If you would save now, your settings would be written to:

CPANPLUS::Config::User

1> Select Configuration file

2> Setup CLI Programs

3> Setup CPANPLUS Home directory

4> Setup FTP/Email settings

5> Setup basic preferences

6> Setup installer settings

7> Select mirrors

8> Edit configuration file

9> Save & exit

10> Quit without saving

Section to configure: [1]:9

Quitting setup, changes are saved to 'CPANPLUS::Config::User'

CPANPLUS 使用

1. CPANPLUS 中安装模块,按i:

1
CPAN Terminal> i  Bundle::CPAN

2. CPANPLUS 中删除模块,按u:

1
CPAN Terminal> u YAML

3. CPANPLUS 中查找模块,按m:

1
CPAN Terminal>m Smart::Comments

4. CPANPLUS 中查找作者的模块,按a:

1
CPAN Terminal>a kai

5. CPANPLUS 中更新所有有新版本的模块,按下o:

1
2
3
4
5
6
CPAN Terminal> o
    1     5.22         5.24     AnyEvent                             MLEHMANN
    2     0.01         1.024    Apache::Filter                       KWILLIAMS
    3     0.01         0.11     Apache::Module                       DOUGM   
    4     0.09         0.10     Apache::Reload                       PHRED

6. 没事也可以更新 CPANPLUS 自己:

1
CPAN Terminal>s selfupdate all

还有很多小功能,以后可能会用这个换掉CPANPLUS本身

可以按e来加入目录到@INC,可以按x来更新index.

转载于:https://www.cnblogs.com/v-BigdoG-v/p/7398631.html

Perl的CPAN和CPANPLUS安装模块介绍相关推荐

  1. 烂泥:perl中CPAN的安装

    本文首发于烂泥行天下 最近一直在学习nagios监控的知识,因为使用SNMP方式进行监测.而nagios的SNMP监测文件是pl结尾的perl脚本,所以需要安装CPAN. 下面就安装CPAN的安装记录 ...

  2. Perl PPM安装模块

    转自:http://blog.sina.com.cn/s/blog_9da70e9c01010h53.html 前面我们介绍了如何在Windows下面安装ActivePerl,ActivePerl有一 ...

  3. 自动化运维工具ansible(安装与模块介绍)

    自动化运维工具ansible(安装与模块介绍) 一.ansible运维工具概述 (一).ansible的特点 (二).ansible的原理 (三)ansible的优点 二.安装ansible 三.an ...

  4. 自动化运维工具ansible的安装管理以及模块介绍

    自动化运维工具ansible的安装管理以及模块介绍 目录 自动化运维工具ansible的安装管理以及模块介绍 一.ansible概述 1.几种常用运维工具比较 2.Ansible简介 3.Ansibl ...

  5. perl环境配置以及Eclipse安装perl开发插件

    简介: 这篇文章将详细介绍 EPIC 组件的安装,EPIC 编辑环境,调试运行环境,着重介绍如何使用 EPIC 来快速.简便.准确地调试 Perl 语言程序,包括对于 Perl 程序的单步执行,断点用 ...

  6. Nginx安装方式介绍

    Nginx安装方式介绍 Nginx的安装方式有两种分别是: 通过Nginx源码通过Nginx源码简单安装 (1)通过Nginx源码复杂安装 (3) 通过yum安装 (2) 如果通过Nginx源码安装需 ...

  7. mysql5.6.24安装perl,linux下perl操作MySQL数据库(需要安装DBI)

    这篇文章主要为大家详细介绍了linux下perl操作MySQL数据库(需要安装DBI),具有一定的参考价值,可以用来参考一下. 感兴趣的小伙伴,下面一起跟随512笔记的小编小韵来看看吧!DBI安装:D ...

  8. 杰瑞学Perl之CPAN(1)

    CPAN(Comprehensive Perl Archive Network:全面的Perl存档网络)是查找任何Perl有关的东西的中心仓库.它包含从整个Perl社区收集来的智慧:成百上千的 Per ...

  9. 爬虫之requests模块介绍

    爬虫之requests模块介绍 requests文档http://docs.python-requests.org/zh_CN/latest/index.html      [文档中包括的快速上手要精 ...

  10. python模块介绍-locustio:性能测试工具locustio

    转自:http://automationtesting.sinaapp.com/blog/m_locustio_doc python测试文章 http://weibo.com/cizhenshi?is ...

最新文章

  1. 什么是原码、反码和补码?
  2. Python 技术篇-mac下安装、卸载pip方法
  3. boost::test模块测试树管理单元测试
  4. 最全的B端产品经理干货知识(3)
  5. 101 Free VMware Tools
  6. 语言基础(9):static, extern 和 inline
  7. E: Sub-process /usr/bin/dpkg returned an error code (1)
  8. php拆分excel,PHP_PHPExcel合并与拆分单元格的方法,本文实例讲述了PHPExcel合并与 - phpStudy...
  9. IntelliJ 平台 2020 年路线图,规划原来这么厉害
  10. 没有人会认真阅读协议,有恶意皆无效
  11. 嵌入式学习(一)嵌入式c语言
  12. python加粗线宽代码_python-增加matplotlib中图例行的线宽
  13. 美国大学计算机理论专业phd,盘点美国那些计算机专业PHD超级难申请的大学
  14. Vue-element-admin 基础模板
  15. 目标检测经典论文——YOLOv3论文翻译(纯中文版):YOLOv3:增量式的改进(YOLOv3: An Incremental Improvement)
  16. html5游戏编程核心技术与实战目录
  17. 1 - Hello MyBatis
  18. 汽车半导体FMEDA的挑战和解决方案
  19. linux 压缩保持属性不变,linux文件压缩
  20. win10系统怎么安装显卡驱动,驱动人生详细教程

热门文章

  1. 高保真扬声器系统的全球与中国市场2022-2028年:技术、参与者、趋势、市场规模及占有率研究报告
  2. Thinkphp 5.0实战 仿百度糯米开发多商家电商平台
  3. oracle认证考试试题及答案,oracle考试试题_oracle认证考试模拟题_oracle试题及答案房地产估价师考试试题_房地产...
  4. STM32实现的语音识别的智能垃圾桶
  5. 图文详解 | 万用表的使用与口诀!十足干货,不要错过!
  6. python笑脸猫图案_酷叮猫编程课堂:python生成字符画
  7. vue2.0 仿蘑菇街
  8. 第二届中国移动“梧桐杯”大数据应用创新大赛总决赛12强名单发布
  9. vscode 支持 X11 Forwarding
  10. 【高项】沟通管理(ITTO)