http://qs321.pair.com?node_id=484300

xdg has asked for the wisdom of the Perl Monks concerning the following question:

Dear fellow monks, I'm interested in hearing your philosophies, practices, opinions and/or rants about what version of module dependencies to list in a Makefile.PL or Build.PL. I've been pondering this for a while (and churning some of my modules on CPAN to fiddle with dependency versions) and have yet to come up with a "system" I'd want to apply consistently.

I see several extremes and some painstaking middle ground:

  1. Just list all prerequisites as needing version "0" -- take any version and let the module user hope that their modules are sufficiently up to date to run without problems and bugs. E.g.:

    # From a Build.PL requires => { Scalar::Util => 0, Test::Exception => 0, Test::More => 0, }
  2. Whenever updating the module, update all dependencies to their latest and greatest versions on CPAN -- causing builds to fail whenever an installer has old versions that can't/won't be updated (legacy support; binary PPM/RPM release cycle, etc.). E.g. (as of today, anyway):

    requires => { Scalar::Util => 1.17, Test::Exception => 0.21, Test::More => 0.60, }
  3. List whatever version of dependencies happen to be installed on the development machine -- i.e. use at least one known working configuration that passes all test as the minimal standard. E.g. (for my Win32 ActiveState Perl 5.8.7, at least since the last time I updated anything):

    requires => { Scalar::Util => 1.14, Test::Exception => 0.20, Test::More => 0.54, }
  4. Work out exactly when certain necessary features became available in each dependency or when significant bugs were fixed -- potentially painstaking and really hard to regression test. E.g. (somewhat contrived):

    requires => { Scalar::Util => 1.09, # first appearance of refaddr() Test::Exception => 0.21, # 0.20 doesn't build well with CPANPLUS Test::More => 0.48, # thread safe }

None of these jump out at me as an "a-ha!" approach that I like.

What other philosophies do people have on this? Is it different for ordinary CPAN modules versus core modules (that may or may not have updated versions on CPAN not yet in core)? Are there certain versions that you target for certain modules no matter what? (E.g. Test::More has morphed rather substantially since it was last included in a core release.)

Your input is greatly appreciated. Regards,

-xdg

Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.