I have been using Dist::Zilla for a project at work, and I've declared all my dependencies in the [Prereqs / Requires] section. That's fine so far.
Now I found that the latest version of one of my dependencies breaks backwards compatibility, so I want to limit the range of versions that I depend on. Something like what cpanm supports:
# from perldoc cpanm
cpanm Plack~">= 1.0000, < 2.0000" # latest of 1.xxxx
cpanm [email protected] # specific version. same as Plack~"== 0.9990"
Or Module::Build:
'Other::Module' => '>= 1.2, != 1.5, < 2.0',
In general, how do I declare this type of dependency using Dist::Zilla?
Dist::Zilla::Prereqs uses CPAN::Meta::Spec to do the prereqs. That doc describes the syntax in the Version Ranges chapter.
So your prereqs would become:
Note the single
=that separates the module name (key) from the version or version range (value).Those versions mean:
Larger or equal to 1.0000 and smaller than 2.0000
Exactly version 0.9990
Greater or equal to 12 and not 1.5 and smaller than 2.0
As you can see, that's exactly the same as for the cpanfile or Module::Build.