|Welcome to the Monastery|
Re^2: Seeking thoughts on version numbers in modulesby xdg (Monsignor)
|on Dec 27, 2004 at 18:19 UTC||Need Help??|
Great comments. #5 is intriguing and I poked around a little to investigate. It looks like CPAN (er., search.cpan.org anyway) maintains version numbers on all files, but only if they exist. And the version of individual files can bear little/no relation to the distribution version. Compare these:
I wonder if the version number for the distribution that CPAN uses even comes from a file at all or simply from the distribution tar file numbering (or a META.yaml file, if it exists). If the latter is true, you could manually set your version in a Makefile.PL or Build.PL and have no VERSION in your files at all.
The only downside I see to this (and to leaving version numbers out of submodules) is that you lose version checking ability. If a distribution contains a "main" module and submodules that would never be directly used, then it won't really matter if you only have a VERSION in your main module file. On the other hand, if a distribution contained modules which could be used independently, then it does matter.
See Test-Simple for an example where this might be the case. (It's not, for reasons I'll explain, but bear with as an example.) Test::Builder's version is out of sync at 0.22 compared to 0.54 for distribution as a whole. In a Makefile.PL or Build.PL, if my list of pre-requisites had Test::Builder => 0.22, and Test::Builder's version number hadn't been updated in a while, I could pass the pre-req with an old version of Test::Builder, even though the distribution version number of the Test-Simple distribution had been updated. It turns out in this case, that Michael does actually increment Test::Builder's number when it changes, but only when it changes and not just because Test::More or Test::Simple or the distribution version number change.
This may suggest a general good practice of using the same module in a prerequisites statement as is being used to generate the version number for the distribution, just in case the distribution author isn't as diligent about maintaining all the version numbers.
Code posted by xdg on PerlMonks is public domain. It has no warranties, express or implied. Posted code may not have been tested. Use at your own risk.