如何“使用" perl CPAN模块的特定版本? [英] How can I 'use' specific version of a perl CPAN module?

查看:249
本文介绍了如何“使用" perl CPAN模块的特定版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有很多Perl代码,它们在测试和生产中会做不同的事情,并且我想将我的代码锁定到特定版本的CPAN模块,以防将来某些代码发生某些更改可能会破坏我的代码.

I have a lot perl code that does different things in test and production, and I want to lock my code to specific versions of CPAN modules in case there are some changes to some of them in the future which may possibly break my code.

所以我想使用我使用的所有模块的特定版本.通过使用我的意思是

So I want to use specific versions of all the modules I use. By use I mean

use XML::Smart 

推荐答案

要使用特定模块,请参考

To use specific module refer only

use only MyModule => 0.30;


如果您要安装的模块版本高于当前安装的模块版本,也将打印错误 你可以说


Also to print error if module version you want is above to currently installed one You can say

use XML::Smart v1.6.9;

use XML::Smart 1.6.9;


为了向后兼容

or
for backward compatibility

use XML::Smart 1.006_009;  

perldoc 引用:

  • 使用模块版本列表
  • 使用模块版本
  • 使用模块列表
  • 使用模块
  • 使用版本
  • use Module VERSION LIST
  • use Module VERSION
  • use Module LIST
  • use Module
  • use VERSION

如果在Module和LIST之间存在VERSION参数,则 use将使用给定的调用类Module中的VERSION方法 版本作为参数.默认的VERSION方法,继承自 UNIVERSAL类,如果给定版本大于值,则发出嘶哑 $ Module :: VERSION的变量.

If the VERSION argument is present between Module and LIST, then the use will call the VERSION method in class Module with the given version as an argument. The default VERSION method, inherited from the UNIVERSAL class, croaks if the given version is larger than the value of the variable $Module::VERSION .

这篇关于如何“使用" perl CPAN模块的特定版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆