现在我发现我的一个依赖项的最新版本打破了向后兼容性,所以我想限制我依赖的版本范围.像cpanm支持的东西:
# from perldoc cpanm cpanm Plack~">= 1.0000,< 2.0000" # latest of 1.xxxx cpanm Plack@0.9990 # specific version. same as Plack~"== 0.9990"
或者模块::构建:
'Other::Module' => '>= 1.2,!= 1.5,< 2.0',
一般来说,如何使用Dist :: Zilla声明这种类型的依赖?
解决方法
Some fields (prereq,optional_features) indicate the particular
version(s) of some other module that may be required as a
prerequisite. This section details the Version Range type used to
provide this information.The simplest format for a Version Range is just the version number
itself,e.g. 2.4. This means that at least version 2.4 must be
present. To indicate that any version of a prerequisite is okay,even
if the prerequisite doesn’t define a version at all,use the version
0.Alternatively,a version range may use the operators < (less than),<=
(less than or equal),> (greater than),>= (greater than or equal),==
(equal),and != (not equal). For example,the specification < 2.0
means that any version of the prerequisite less than 2.0 is suitable.For more complicated situations,version specifications may be AND-ed
together using commas. The specification >= 1.2,< 2.0
indicates a version that must be at least 1.2,less than 2.0,and not
equal to 1.5.
所以你的先决条件将成为:
[Prereqs] Plack = >= 1.0000,< 2.0000 Plack = == 0.9990 Other::Module = >= 1.2,< 2.0
请注意,single =将模块名称(键)与版本或版本范围(值)分开.
这些版本意味着:
>
>= 1.0000,< 2.0000
大于或等于1.0000且小于2.0000
>
== 0.9990
完全版本0.9990
>
= 1.2,< 2.0
大于或等于12而不是1.5且小于2.0
如您所见,这与cpanfile或Module :: Build完全相同.