需要解决2个问题:

1、  如何与CPAN交互:利用perl –MCPAN –e ‘install 模块’

2、  如何安装指定的版本:作者/模块-版本.tar.gz

How to install a specific version of a Perl module with CPAN

Mar 27, 2013 by David Farrell

Perl modules are usually installed via CPAN on the command line. This is invoked with the following syntax:

cpan My::Module

CPAN will always try to install the latest stable version of a module, which is a sensible default, however this may not always be the required behaviour. To have CPAN install a specific version of a module, you need to provide the full module distribution filename including the author. For example to install the module Set::Object version 1.28, at the command line type:

cpan SAMV/Set-Object-1.28.tar.gz

You can find the distribution filename for a module by searching for the module on CPAN.

 

完整例子:

#!/bin/sh

perl -MCPAN -e 'install "TIMB/DBI-1.639.tar.gz"' #安装DBI1.639版本

version=`perl -MDBI -e  'print DBI->VERSION'` #检查版本

if [ "$version" == "1.639" ]; then

echo "install ok"

else

echo "install fail"

fi

最新文章

  1. postman测试接口之POST提交本地文件数据
  2. 夺命雷公狗-----React---20--实现验证码大写
  3. 清北国庆day1 (脑)残
  4. Unity Sprite转Prefab
  5. Android Material Design : Ripple Effect水波波纹荡漾的视觉交互设计
  6. iTween基础之Fade(淡入淡出)
  7. [转]FFMPEG视音频编解码零基础学习方法
  8. cocos2d-x jsbinding 资源下载实现
  9. 48种CIFilter
  10. [NYOJ 43] 24 Point game
  11. Apache MINA 框架之默认session管理类实现
  12. php各项下载地址
  13. python替换残缺的多域名图片网址
  14. svn"database disk image is malformed"错误解决
  15. Navicat premium 破解步骤
  16. JavaScript入门篇
  17. maven配置私服
  18. js 基础知识总结
  19. 微信小程序项目
  20. 光学定位点(mark点)

热门文章

  1. xBIM 基础12 WeXplorer xViewer的导航、相机、剖切、隐藏等操作
  2. Spark 运行机制及原理分析
  3. Android 常用系统服务
  4. P1776 宝物筛选_NOI导刊2010提高(02)(背包的二进制优化)
  5. IEEE Access的模板的问题
  6. 你不知道的JavaScript(九)switch语句
  7. 【原创】关于JMS[1]
  8. 「JavaSE 重新出发」02.02 引用数据类型
  9. ZBrush笔刷属性栏简介
  10. WordPress开启伪静态