Looks like I missed that one. I really should write a preprocessor to put the same version in both places. But I assure you, it is bona fide 0.03 goodness, for whatever definition of "goodness" you attach to a version number so far from 1.0.
/s
update: Okay, here's a quick hack to avoid this in the future. Lightly tested on my system. *NIX-only. Please read the code before using it.
#!/usr/bin/env perl
use strict;
my $distrib;
my $pkg = shift;
if ($pkg eq '-p') {
$distrib = 1;
$pkg = shift;
}
$pkg or die <<USAGE;
Usage: $0 [-p] packagename
Find the canonical \$VERSION in a module.
With -p, also create a distribution tarball.
USAGE
# Find the Makefile.PL
(my $dir = $pkg) =~ s/::/-/g;
open IN, "$dir/Makefile.PL" or die "$dir/Makefile.PL: $!";
my ($ver_from) = grep /VERSION_FROM/, <IN>;
close IN;
# Find where our version should come from.
if ($ver_from =~ /VERSION_FROM.*?=>\s*([^,]+)/) {
# Eval to remove quotes.
$ver_from = eval qq{$1};
} else {
die "Can't find VERSION_FROM for $pkg";
}
# Okay, find the version from the $VERSION line.
open IN, "$dir/$ver_from" or die "$dir/$ver_from: $!";
my ($ver) = grep /\$VERSION/, <IN>;
close IN;
if ($ver =~ /VERSION\s*=\s*(\S+)\s*;/) {
$ver = eval qq{$1};
} else {
die "No version for $pkg in $ver_from";
}
print STDERR "version = $ver\n";
if ($distrib) {
# Tidy up and package.
system "cp -rp $dir $dir-$ver";
system "cd $dir-$ver; make clean; rm ./*~";
system "perl -i -pe 's/#VERSION#/$ver/' $dir-$ver/README";
system "tar czvf $dir-$ver.tgz $dir-$ver";
}
|