# from John Peacock
# on Sunday 28 January 2007 11:56 am:
>John Peacock wrote:
>>> use version $VERSION = qw$Revision: 1.2$[1];
>>>
>>> What's different about cvs versions?
>
>Oh, I just remembered what the difference is: CVS versions need to go
> through qv() (or equivalent code) because they are incremented as
> subversions, not as floating point numbers (so 1.10 follows 1.9). So
> I *do* need to have a list context on the right so I can tell those
> cases apart.
True, though there seems to be quite a bit of sprintf and such already.
use version $VERSION = 'v' . (qw$Revision 1.2$)[1];
I suppose the => syntax still matches the regexp in ExtUtils::MM_Unix,
though the way it does the eval causes VERSION to turn out as undef due
to compile/run-time distinctions. M::B::ModuleInfo appears to have the
same issue.
One possible solution for that may be:
my $sub;
my $eval = qq{BEGIN { q# Hide from _packages_inside()
#; package Module::Build::ModuleInfo::_version;
no strict;
local $sigil$var;
\$$var=undef;
\$sub = sub {$line; \$$var}
}};
local $^W;
# Try and get the $VERSION
warn "compile $eval";
my $result = eval $eval;
warn "Error evaling version line '$eval' in $self->{filename}: [EMAIL
PROTECTED]"
if $@;
(ref($sub) eq 'CODE') or die;
$result = $sub->();
warn "yay $result\n";
Though I have to admit I'm not sure what the local is trying to do (or
rather, why we also then need the undef.) I've tested it with these.
use foo $VERSION=1.2.0;
use foo $VERSION='v' . (qw$Revision: 1.2$)[1];
use foo our $VERSION=1.2.0;
use foo $bar::VERSION=1.2.0;
--Eric
--
Peer's Law: The solution to the problem changes the problem.
---------------------------------------------------
http://scratchcomputing.com
---------------------------------------------------