What's the consensus on the version numbers to give to different modules in a CPAN distribution?
Thank you all for your great feedback. I personally have always considered it important for all modules in a distribution to have version numbers, though not necessarily the same one. To me, it makes sense that they have separate numbers, because they don't necessarily change when the main module changes.
The only disadvantage to this approach is the circumstance in which, for example, someone uses the version number in their requirements of a module in your distribution that's not the main module. If the secondary module doesn't change but the primary one does, it might make a difference. But probably not. I think this would be a rare circumstance.
For the Bricolage project, I use CVS revision numbers for my module numbers, like Andy does. Andy's syntax is this:
$VERSION = sprintf("%d.%02d", q$Revision: 1.23$ =~ /(\d+)\.(\d+)/);
The disadvantage to his approach, however, is that it only works if you never branch. Otherwise, your modules could change, but the version number wouldn't change, because only the first two numbers make it into the module. So if the version number is 1.3.20, and then you change the module and the version increments to 1.3.21, the version number would still be 1.03.
It also won't work if your subversion numbers get to be over 100. So if the Revision is 1.145, the version would be 1.14, which wouldn't work, since version 1.14 was released ages ago. For Bricolage, we use this syntax, instead:
our $VERSION = (qw$Revision: 1.63 $ )[-1];
This captures the entire Revision number. For Bricolage 2.0, we're actually going to use John Peacock's version module, instead:
our $VERSION = version->new(qw$Revision: 1.7 $);
Now, all that said, I think I'll continue to just use independent, but manual, version numbers for my CPAN modules. This is because most of them don't have too many modules, and only a few of them will change between releases. For bigger projects, I'll go with the CVS Revision number solution.
I do like Aristotle's idea of providing a line in the POD that says what version of the distribution a module came with. Guess I'll start working on a module that does the following:
* Updates the distribution number line in POD.
* Validates that the main module, README and Changes have the same version number.
Yeah, right...in my spare time!
Thanks again for all your thoughts! You all have confirmed that what I've been doing may be considered a best practice -- or among the acknowledged best practices!
Regards,
David
-- David Wheeler AIM: dwTheory [EMAIL PROTECTED] ICQ: 15726394 http://www.kineticode.com/ Yahoo!: dew7e Jabber: [EMAIL PROTECTED] Kineticode. Setting knowledge in motion.[sm]
