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.

-xdg

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.


In reply to Re^2: Seeking thoughts on version numbers in modules by xdg
in thread Seeking thoughts on version numbers in modules by xdg

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.