in reply to Re: cvs revision extraction regex
in thread cvs revision extraction regex
I used the same until I ran into a problem comparing versions between a single and double-digit minor version.
my $new = 1.41; my $old = 1.5; print $new > $old ? $new : $old;
I figured 'nothing a fancier sort can't fix, right?' until I realized it also broke use My::Module N.NN;, so thesedays I use a style I saw in one of Gisle Aas' modules...
$VERSION = sprintf("%d.%02d", q$Revision: 1.5 $ =~ /: (\d+)\.(\d+)/);
That way single digits get 0-padded (ie, 1.05 vs 1.5, although 1.1.1.1 gets turned into 1.01) and all is right with the world again. :)
--k.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: cvs revision extraction regex
by chicks (Scribe) on Apr 22, 2002 at 18:40 UTC |