Re: error creating 'BUILD' script

John Peacock <[email protected]> Wed, 23 Sep 2009 10:23:57 -0400
Newsgroups gmane.comp.lang.perl.modules.module-build
Message-ID <[email protected]>
demerphq wrote:
> Remember the old Perl maxim of "be tolerant of what you expect and
> strict with what you emit".
> 
> Are there technical reasons why this should be disallowed?

Internally, version objects are stored as an array of integers for 
comparison purposes.  Normally, that array is split on periods (decimal 
points) or groupings of three digits (for decimal versions).  When an 
underbar/underscore is encountered, that is used as an additional split 
character and the is_alpha flag set, so that the last "digit" of the 
version is the "alpha release".  The original string representation is 
stored as well (and is used for stringified output); the internal 
representation is only used for comparison purposes.

I don't have any way of encoding which separators were used between 
"digits", so the code assumes that if is_alpha is set, then the last 
(and only the last) separator was an underbar; any others are assumed to 
be periods (decimal points).  If we were to allow an arbitrary string 
containing one-or-more periods and/or one-or-more underscores, not only 
would the internal representation need to accommodate that, but the 
comparison scheme would similarly need to be augmented.  As it stands now:

	1.002 < "1.002_01" < 1.002_01 == 1.00201

(i.e. the unquoted underscore gets eaten by tokenizer).  In other words, 
an alpha release is larger than the next smaller non-alpha release and 
yet less than a non-alpha release with the same "digits".  Thus the 
alpha release exists in between the cracks of two adjacent non-alpha 
releases.

John