Front page | perl.perl5.porters |
Postings from February 2007
Re: $Win32::VERSION problem
From: John Peacock
February 26, 2007 11:18
Re: $Win32::VERSION problem
Message ID: 45E33287.email@example.com
Jan Dubois wrote:
> I think this is exactly backwards. This should depend on the type of
> VERSION used in "use Module VERSION". perlfunc.pod says:
> | VERSION may be either a numeric argument such as 5.006, which will be
> | compared to C<$]>, or a literal of the form v5.6.1, which will be
> | compared to C<$^V> (aka $PERL_VERSION.
> | If the VERSION argument is present between Module and LIST, then the
> | C<use> will call the VERSION method in class Module with the given
> | version as an argument. The default VERSION method, inherited from the
> | UNIVERSAL class, croaks if the given version is larger than the value
> | of the variable C<$Module::VERSION>.
> If VERSION is a number, as specified by the *user* (not the module
> author), then the error message should use this requested version
> number, and not some re-interpretation of it.
That's a very good argument, I must say. I haven't gone and modified
all of the other POD that talks about $VERSION's, but in this case, I
don't need to do so. I can just make UNIVERSAL::VERSION correspond to
this behavior with a stroke of my magic pen... ;-)
I'd like to get more feedback before I do so, since I would be changing
an established API (sort of, since I consider everything before v5.10.0
ships to be preparatory). Anyone else want to weigh in here? I also
what to hear from people who don't like $version->is_alpha() denote a
version with an embedded underscore (usually used for development
releases to CPAN).
> Of course if the module uses extended version numbers (not just a
> string, but a version that cannot be represented as a float), then the
> error message will have to be more complex.
Currently, the only way to use non-numbers with $VERSION is through the
use of my own version::AlphaBeta (which AFAIK, no one is using on CPAN
certainly). In that case, the ruling module would be
version::AlphaBeta, which restricts what you can enter on the 'use' line
to what it recognizes anyways.
> I also do disagree with the normalization to three decimal multiples. It
> serves no purpose for normal numbers and should only be done for
> extended version numbers.
0.27 is mathematically equivalent to 0.270 (or any number of trailing
zeros). While I can preserve the original notation for output purposes
(which is incidently what the Module::Build::Version subclass does), it
would make for more complicated code in the base version class. Does
this bother you so much that it is worth complicating things?
Internally, it would still be stored as three-digit subversions (since
this is how the extended and floating point map to each other).
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4501 Forbes Boulevard
Lanham, MD 20706