>From: Andreas Koenig <k@anna.mind.de>
>Dean Roehrich <roehrich@cray.com> writes:
>
> > We need to get MM to set the PM's version number, folks. Right now MM
> > doesn't help us at all unless the extension uses two or more XS files, and
> > that's a rare occasion.
>
>I cannot see any justification to change any file while running
>Makefile.PL. The reasonable way IMO is to go the other
>direction. Makefile.PL *parses* a pm file and determines the version
>number. This is currently up to the authors, and I admit, we could
>make it easier for them.
Sounds good to me, as VERSION_DRIVER or VERSION_FROM.
Okay, if this happens, we can replace the MM VERSION attribute with
'VERSION_DRIVER' => 'Foo.pm',
right? Then, in this case, the version is always set in Foo.pm and MM makes
sure that XS_VERSION matches it?
Should h2xs use this in its Makefile.PL template?
>
> while(<PM>) {
> if(/^\s*\$VERSION\s*=/) {
> $version = eval $_;
> last;
> }
> }
I may have a 'local' or 'my' on the front. I may have it fully-qualified.
>From: Tim Bunce <Tim.Bunce@ig.co.uk>
>I'd use a local($VERSION) and not use the return value from the eval.
>I'd also loosen the /^\s* since some people may do ($VERSION = ...) =~ ...;
That, too.
The code below handles all of the cases mentioned here.
Dean
-------
$module = 'FOO';
local $VERSION;
while(<DATA>){
chop;
if( /VERSION[^=]*=/ ){
s/^\s*(?:my|local)//;
print "eval($_)\n";
eval $_;
print "version($VERSION)\n";
}
}
__END__
$VERSION = '1.00';
my $VERSION = '1.01';
my( $VERSION ) = '1.011';
my( $VERSION ) = '$Revision: 1.12 $' =~ /\$Revision:\s+([^\s]+)/;
local $VERSION = '1.02';
$FOO::VERSION = '1.10';
my $FOO::VERSION = '1.20';
local $FOO::VERSION = '1.30';
>Dean Roehrich <roehrich@cray.com> writes:
>
> > We need to get MM to set the PM's version number, folks. Right now MM
> > doesn't help us at all unless the extension uses two or more XS files, and
> > that's a rare occasion.
>
>I cannot see any justification to change any file while running
>Makefile.PL. The reasonable way IMO is to go the other
>direction. Makefile.PL *parses* a pm file and determines the version
>number. This is currently up to the authors, and I admit, we could
>make it easier for them.
Sounds good to me, as VERSION_DRIVER or VERSION_FROM.
Okay, if this happens, we can replace the MM VERSION attribute with
'VERSION_DRIVER' => 'Foo.pm',
right? Then, in this case, the version is always set in Foo.pm and MM makes
sure that XS_VERSION matches it?
Should h2xs use this in its Makefile.PL template?
>
> while(<PM>) {
> if(/^\s*\$VERSION\s*=/) {
> $version = eval $_;
> last;
> }
> }
I may have a 'local' or 'my' on the front. I may have it fully-qualified.
>From: Tim Bunce <Tim.Bunce@ig.co.uk>
>I'd use a local($VERSION) and not use the return value from the eval.
>I'd also loosen the /^\s* since some people may do ($VERSION = ...) =~ ...;
That, too.
The code below handles all of the cases mentioned here.
Dean
-------
$module = 'FOO';
local $VERSION;
while(<DATA>){
chop;
if( /VERSION[^=]*=/ ){
s/^\s*(?:my|local)//;
print "eval($_)\n";
eval $_;
print "version($VERSION)\n";
}
}
__END__
$VERSION = '1.00';
my $VERSION = '1.01';
my( $VERSION ) = '1.011';
my( $VERSION ) = '$Revision: 1.12 $' =~ /\$Revision:\s+([^\s]+)/;
local $VERSION = '1.02';
$FOO::VERSION = '1.10';
my $FOO::VERSION = '1.20';
local $FOO::VERSION = '1.30';