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

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

From:
David E. Wheeler
Date:
September 7, 2011 09:57
Subject:
Re: [rt.cpan.org #70622] Versions Disappear
Message ID:
9375FAA3-25BC-4508-8F67-0686ED84FECA@kineticode.com
On Sep 7, 2011, at 4:05 AM, Nicholas Clark wrote:

> Yes, this is accurate, but missing the complaint:
> 
> A *different* version of the Perl core.
> 
> The CPAN release contains the current Perl core semantics. That's good.
> 
> But what this means is that on any *previous* major release, any module
> can load version.pm and as a side effect change core semantics everywhere.
> Effectively, loading version.pm behaves like upgrading perl to a different
> major version. At runtime. From any module's code.
> 
> 
> I don't have a solution to that. But that's the concern. Legitimate in my
> opinion.

I think that's a legitimate beef. But it would also mean that one could, theoretically, have a core version.pm that did one thing and a CPAN version.pm that did something else. If that was the case, I'd be satisfied. Have VERSION() return a version object in core but not in the CPAN version (or, more specifically, not on Perl < 5.10.0).

But that's not what Father C was complaining about, IIRC. The bug he wanted fixed was that VERSION()  failed to return a version string if it was invalid. Hell, that could be fixed with something like:

    sub VERSION {
        my $self = shift;
        my $v = *{ref $self . '::VERSION'};
        if (@_) {
            # Do comparison stuff
        } else {
            return version->parse($v) || $v;
        }
    }

That would oppose what David Golden thinks is best, however.

But honestly, isn't it time we figured out what's the *correct* thing to do, and do that? Maybe scope it with `use v5.10` or even `use v5.16`, and then just do that? Time to find a solution and end the pain (not to mention the arguments).

Best,

David


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