develooper Front page | perl.perl5.porters | Postings from February 2007

RE: $Win32::VERSION problem

Thread Previous | Thread Next
From:
Jan Dubois
Date:
February 26, 2007 10:53
Subject:
RE: $Win32::VERSION problem
Message ID:
019601c759d7$528f4430$f7adcc90$@com
On Mon, 26 Feb 2007, John Peacock wrote:
> Jan Dubois wrote:
> > This is a reason why I don't want to 'use version'. I'm using plain
> > numbers as the version, and therefore shouldn't have to worry about all
> > this other stuff.  I hope you at least realize that the new error message
> > is much more confusing for the novice user who couldn't care less
> > about version objects.
> 
> As long as you use exclusively numeric versions, you shouldn't notice
> any difference with 'use version' at all (apart from the [improved]
> error message).  Personally, I don't think that the error message is all
> that confusing, but if that is the feeling of the group, I could make
> the output dependent on whether the module $VERSION was numeric or
> extended.

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.

I think readability of error messages should be optimized for
(potentially novice) users, and not for the module author, who will
generally be more knowledgeable about this stuff already.

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.

> In other words, the error message that Steve (Hay) would have seen would
> have been this instead:
> 
> 	Win32 version 0.270 required--this is only version 0.260
> 
> (the trailing zero is due to the version being normalized on three
> decimal multiples).

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.

Cheers,
-Jan 



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