develooper Front page | perl.perl5.porters | Postings from July 2005

[perl #2741] [BUG] version checking doesn't work per apparent docs

Thread Next
From:
Michael G Schwern via RT
Date:
July 23, 2005 01:18
Subject:
[perl #2741] [BUG] version checking doesn't work per apparent docs
Message ID:
rt-3.0.11-2741-118184.9.50066398509982@perl.org
> [tchrist@chthon.perl.com - Tue Mar 28 03:38:58 2000]:
> 
> From perldata:
> 
>    A literal of the form `v1.20.300.4000' is parsed as a string
>    composed of characters with the specified ordinals.  ....  Such
>    literals are accepted by both `require' and `use' for doing a
>    version check.
> 
> This is not true, however.  Witness:
> 
> % perl -MIO::File -le 'print IO::File::->VERSION
> 1.08
> 
> % perl -e 'use IO::File  1.08'
> 
> % perl -e 'use IO::File  v1.08'
> Octal number in vector unsupported at -e line 1, at end of line
> BEGIN not safe after errors--compilation aborted at -e line 1.
> 
> # vector?  qu'est-ce que c'est qu'un vector? 
> # did I vec() something for select()?
> 
> % perl -e 'use IO::File  1.8'
> IO::File version 1.8 required--this is only version 1.08 at -e line 1.
> BEGIN failed--compilation aborted at -e line 1.
> 
> % perl -e 'use IO::File  v1.8'
> 
> % perl -e 'use IO::File  1.8.2'
> 
> % perl -e 'use IO::File  v1.8.2'
> 
> % perl -e 'use IO::File  1.9.2.20'
> 
> % perl -e 'use IO::File  v1.9.2.20'
> 
> % perl -e 'use IO::File  1.9.9'
> 
> % perl -e 'use IO::File  1.9.9999.9999999'
> 
> % perl -e 'use IO::File  v1.9.9'
> 
> % perl -e 'use IO::File  v1.9.9999.9999999'
> 
> ### Ick ick ick!  Something sure smells pretty icthy around here.
> 
> # And here's some naive stuff.  Remember: version were always numbers
> # before.  So one expects numbers to continue to work.  But they don't.
> # And produce very odd msgs.
> 
> % perl -MIO::File -e 'printf "%d\n", IO::File::->VERSION >  1.8'
> 0
> 
> % perl -MIO::File -e 'printf "%d\n", IO::File::->VERSION >  v1.8'
> 1
> 
> % perl -MIO::File -e 'printf "%d\n", IO::File::->VERSION <  1.8'
> 1
> 
> % perl -MIO::File -e 'printf "%d\n", IO::File::->VERSION <  v1.8'
> 0
> 
> % perl -MIO::File -e 'printf "%d\n", IO::File::->VERSION == 1.08'
> 1
> 
> % perl -MIO::File -e 'printf "%d\n", IO::File::->VERSION == v1.08'
> Octal number in vector unsupported at -e line 1, at end of line
> Execution of -e aborted due to compilation errors.
> 
> # octal huh?
> 
> % perl -MIO::File -e 'printf "%d\n", IO::File::->VERSION == v1.80'
> Octal number in vector unsupported at -e line 1, at end of line
> Execution of -e aborted due to compilation errors.
> 
> % perl -MIO::File -we 'printf "%d\n", IO::File::->VERSION == v1.80'
> Argument "^AP" isn't numeric in numeric eq (==) at -e line 1.
> 0
> 
> # That's disgusting.  Run it through uncontrol!

v1.2.3 style version strings are being "phased out" and should be
replaced by the various options presented by version.pm.

All the above now works in 5.8.6 with the exception of the final
"Argument "^AP" isn't numeric" warning which is still there.  As version
strings are going bye-bye will that ever be fixed?


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