develooper Front page | perl.perl5.porters | Postings from August 2011

Fwd: [rt.cpan.org #70622] Versions Disappear

From:
David E. Wheeler
Date:
August 31, 2011 20:22
Subject:
Fwd: [rt.cpan.org #70622] Versions Disappear
Message ID:
0C6417C0-8192-46FF-AB7C-0AA025E9E9F7@kineticode.com
Porters,

Can someone explain this to me? I don't understand why Package->VERSION would return something that's not printable. I've been using this in code for years, e.g.,

            meta {
                name is 'generator';
                content is 'PGXN::Manager ' . PGXN::Manager->VERSION;
            };

On Aug 31, 2011, at 5:41 PM, John Peacock via RT wrote:

> <URL: https://rt.cpan.org/Ticket/Display.html?id=70622 >
> 
> On Tue Aug 30 20:28:35 2011, david@kineticode.com wrote:
>> I'm using Perl 5.14.1 on Mac OS X 10.7 "Lion". I compiled Perl myself.
>> With any of version v0.92-v0.94 installed from CPAN, I get this:
>> 
>>    perl -MPGXN::Meta::Validator -E 'say PGXN::Meta::Validator-
>>> VERSION'
>> 
>> 
>> That's no version.
> 
> No, it is just invisible (actually the nonprintable ShiftOut character):
> 
> $ cat VTest.pm
> package VTest;
> our $VERSION=v0.14.0;
> 1;
> 
> $ perl -I. -MVTest -e 'print $VTest::VERSION'
> 
> $ perl -I. -MVTest -e 'printf("%vd", $VTest::VERSION)'
> 0.14.0
> 
> NOTE: I am not using version.pm's UNIVERSAL::VERSION at all, so you can
> see the actual behavior that is being demonstrated.
> 
> The complaint was raised on p5p that UNIVERSAL::VERSION returned a
> stringified version object when use without a parameter, rather than the
> contents of the package's $VERSION scalar.  So, in both the bleadperl
> release and the CPAN release of version.pm, UNIVERSAL::VERSION now
> returns the actual contents of the scalar (which 
> is what it used to do before version objects were added to the core).  
> 
> I don't like it, but there you go.  Bring it up on p5p and maybe you can
> convince everyone else... :(


Thanks,

David





nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About