develooper Front page | perl.perl5.porters | Postings from September 2009

Re: [perl #69452] UNIVERSAL::VERSION method docs fail to stateacceptable values of $VERSION

Thread Previous | Thread Next
From:
Abigail
Date:
September 29, 2009 04:59
Subject:
Re: [perl #69452] UNIVERSAL::VERSION method docs fail to stateacceptable values of $VERSION
Message ID:
20090929115913.GA2133@almanda
On Tue, Sep 29, 2009 at 12:12:19PM +0200, Steffen Mueller wrote:
> Hi Richard,
>
> Richard Soderberg wrote:
>> # New Ticket Created by  Richard Soderberg # Please include the string: 
>>  [perl #69452]
>> # in the subject line of all future correspondence about this issue. # 
>> <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=69452 >
>
>> UNIVERSAL 1.05 says that:
>>
>>   C<VERSION> will return the value of the variable C<$VERSION> in the
>> package the object is blessed into.
>>
>> However, this is not true for all values of $VERSION:
>>
>>   #!/usr/bin/perl -E
>>   $Foo::VERSION = "3.210"; say Foo->VERSION;
>>   $Bar::VERSION = "3.210pre"; say Bar->VERSION;'
>>
>>   __DATA__
>>   3.210
>>   0
>>
>> The documentation has no mention of this behavior.
>
> I tried to reproduce this on bleadperl, 5.10.1, and 5.10.0 and all three  
> produce:
> 3.210
> 3.210
>
> The only change is that I put a 'use 5.010;' in front of the two lines.
>
> Now, whether this is the expected behaviour is another issue altogether.  
> I'd expect it to behave the same as version.pm's  
> "".version->new("3.210pre") and if someone in the know could confirm  
> that, then documenting that it's passed through a version object may be  
> worthwhile.


Running with warnings turned on reveals:

  $ perl -wE '$Foo::VERSION = "3.210pre"; say Foo -> VERSION'
  Version string '3.210pre' contains invalid data; ignoring: 'pre' at -e line 1.
  3.210

That's on both 5.10.0 and 5.10.1. It doesn't matter whether a 'use 5.010'
is there or not (I get the same output if a replace -E with -le, and say
with print). 5.8.8 doesn't give me the warning, and outputs '3.210pre'.


Abigail

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