develooper Front page | perl.perl5.porters | Postings from January 2008

Re: Dev version numbers, warnings, XS and MakeMaker dont play nicely together.

Thread Previous | Thread Next
January 6, 2008 17:26
Re: Dev version numbers, warnings, XS and MakeMaker dont play nicely together.
Message ID:
demerphq wrote:
>$VERSION= "1.23_01";

I've not seen that form, but

	$VERSION = 1.23_01;

which of course doesn't put the underscore in the string value.  This
still delimits the subrevision portion, but without forcing anything
else to handle the delimiter.

>but this will produce warnings if you assert a required version
>number, as the version isn't numeric.

I've found a similar problem when attempting to include underscores in
dependency version numbers in Makefile.PL.  Now I never use underscores in
version numbers in any context, because it's the only way to completely
eliminate that class of problems.  I don't think the underscore is
essential; the bare number has all the right semantics, and a module
author's numbering convention is generally clear from the Changes file.

For my own modules I use three digits for each part of the version
number, like the perl core, rather than the usual two for modules.
This has the side effect of making the version number structure clearer.
"1.023001" isn't difficult to tease apart.


Dumb approach.  Now you have two different values for $VERSION depending
on how much of the code gets executed (read: depending on who's looking).
It's a recipe for trouble, as in the case you note with XS.

>BUT, if the module is "bog standard" and uses XS this is a recipe for
>a fatal error. XS_BOOT_VERSIONCHECK will compare "1.23_01" to "1.2301"
>and decide that they are different versions and die.

Presumably XS_BOOT_VERSIONCHECK should be stripping out underscores,
and trailing zeroes too, to just compare the numerical values.  Even if
it operates purely on strings, this transformation is not difficult to
do implicitly during the comparison.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About