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

Re: [ #70622] Versions Disappear

David E. Wheeler
September 3, 2011 22:51
Re: [ #70622] Versions Disappear
Message ID:
On Sep 1, 2011, at 3:35 AM, John Peacock wrote:

>>             meta {
>>                 name is 'generator';
>>                 content is 'PGXN::Manager ' . PGXN::Manager->VERSION;
>>             };
> Just as an aside, using UNIVERSAL::VERSION in this fashion worked like this up until Perl 5.10.0, meaning if the module in question used a v-string for its $VERSION scalar, the output was not printable without work.
> Here is the original discussion for your perusal:

So let me see if I understand this correctly. Starting with Perl 5.10, UNIVERSAL::VERSION returned a version object that, when used in a string context, stringified to its original, declared form (which for vstrings meant sprintf "v%vd"). But in bleed and 0.92-0.94, UNIVERSAL::VERSION now returns exactly the same value as $Foo::VERSION. Which kind of obviates the use of UNIVERSAL::VERSION when called with no arguments, no?

I think if I had noticed this thread before I would have argued with David Golden about this point. It seems to me that a version object is far more useful in general than whatever crap happened to be put into $VERSION -- and the latter can be fetched directly, anyway. 

Father C said the original bug was this code, which worked in 5.8 but broke in 5.10;

    $VERSION = "3alpha";

    sub VERSION {
        my $version = shift->SUPER::VERSION;
        if(@_) {
            .... do custom comparison ....
            die $message if $too_old

I can see that, since the version isn't a valid version object value. But how often was this complained of? I mean, I dunno, this seems to me more like one of those areas where backward compatibility is maintained despite the fact that folks made lousy version number decisions.

OTOH, I suppose you might be thinking I'm making a poor choice using vstrings for versions.

/me shrugs. Version stuff sucks. Guess I'll add this method to my class:

    sub VERSION {
        my $self = shift;
        return $self->SUPER::VERSION(@_) if @_;
        return verson->parse($version);

BTW, was the awful behavior of having set $VERSION to -1 been fixed?




David Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About