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
From:
Zefram
Date:
January 6, 2008 17:26
Subject:
Re: Dev version numbers, warnings, XS and MakeMaker dont play nicely together.
Message ID:
20080107012607.GU16879@fysh.org
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.

>$VERSION= eval $VERSION;

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.

-zefram

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About