简体   繁体   中英

Fixing Perl CPAN modules - where to add prerequsites and what version to use?

When I find a problem with a CPAN module where there are missing prerequisites I want to help out by providing a patch via rt.cpan or a pull request via GitHub .

Say I find a problem with ACME::MadeUpName , which is missing a prerequisite Foo::Bard . Would I just update the Makefile.PL adding ACME::MadeUpName to the PREREQ_PM section? Are there any other places I should update this?

Also, how do I figure out which version of Foo::Bard to require? Do I just go with the latest CPAN release?

If the release uses ExtUtils::MakeMaker or Module::Install, then Makefile.PL needs updating. If it uses Module::Build, then Build.PL instead. But in many cases, the Build.PL or Makefile.PL file won't be something the author manually maintains, but is built by some kind of release management tool, such as Dist::Zilla, in which case it's better to change the tool's config file rather than Build.PL or Makefile.PL (which would simply be overwritten anyway).

If you're unsure, it may be easier to simply submit a bug report without a patch for this kind of issue. It's probably a matter of 30 seconds work for the module author to fix - they're the ones who are going to be most familiar with their own build tools and release process.

In terms of versions, unless there's a particular feature of Foo::Bard used by ACME::MadeUpName that you know was added in a later version, declare a dependency on Foo::Bard 0 . Maybe later on it will turn out that 0 was overly optimistic, and a higher version number is required, but that bridge can be crossed when you come to it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM