[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

Re: $VERSION in Opcode



On Sun, Sep 28, 2008 at 09:34:12AM -0400, John Peacock wrote:
> Matt S Trout wrote:
> > Right, but version.pm messes around with other things, like making
> > UNIVERSAL::VERSION return different values than it would.
> 
> $VERSION handling was broken in the Perl core prior to 5.10.0.  It was stupid
> and inconsistent: pure Perl modules were compared as a number (even if you
> quoted the term which would lead to the "not a number" warnings), but XS modules
> were compared stringwise.  v-strings (introduced in 5.6.0) didn't do what you
> thought they did, even if you knew what they did.  I worked for over 6 years to
> get version.pm to the point where every way that I could conceive of assigning
> to $VERSION would DTRT, no matter which version of Perl you were running.

And it's an impressive improvement, and if it didn't fuck over UNIVERSAL I'd
now be happily using it for all version comparisons.

However, I'm unable to use Module->VERSION in standalone code anymore because
a simple piece of code that uses the version number can then fail -on the
same perl- because something -else- loaded version.pm.

Which is *not* doing the right thing, at all.

> > Since I refuse to load things that hack UNIVERSAL without my permission
> > I can't use version.pm - I actually have code in DBIx::Class that works
> > around that particular piece of brain damage.
> 
> The *only* way to make $VERSION handling consistent was to fix the dainbramage
> inside the Perl core itself so that it was the same across Perl releases.  What
> part of the definition of a "pragma" isn't clear?

The definition of pragma is perfectly clear. pragmas operate in a lexically
scoped fashion so they only affect the code I explicitly ask for them in, not
the entire interpreter.

Which is why version.pm is -not- a pragma, it's a very useful version
comparison library that unfortunately also inflicts a nasty monkeypatch
on your interpreter with no way to turn it off.

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/


Follow-Ups from:
John Peacock <john.peacock@havurah-software.org>
References to:
Nicholas Clark <nick@ccl4.org>
"Rafael Garcia-Suarez" <rgarciasuarez@gmail.com>
Nicholas Clark <nick@ccl4.org>
Zefram <zefram@fysh.org>
Matt S Trout <matt-p5p@trout.me.uk>
John Peacock <john.peacock@havurah-software.org>
Matt S Trout <matt-p5p@trout.me.uk>
John Peacock <john.peacock@havurah-software.org>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]