[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Elegant ways to pick up the RCS revision



On Sat, Apr 07, 2001 at 08:14:22AM -0400, Bernie Cosell wrote:
> On 7 Apr 2001, at 11:40, Abhijit Menon-Sen wrote:
> 
> > On 2001-04-06 23:57:55, bernie@fantasyfarm.com wrote:
> > > 
> > > my $version = (split(/ /, '$Revision: $'))[1] ;
> > 
> > ($VERSION) = q$Revision: 1.01 $ =~ /(\d+\.\d+)/;
> 
> Doesn't quite work [e.g., the revision I'm looking at right now is 
> 1.14.2].   But that's easy to fix:
> 
> ($VERSION) = q$Revision: 1.01 $ =~ /(\d+(?:\.\d+)+)/;

The example in perlmod is:

$VERSION = do { my @r = (q$Revision: 2.21 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; # must be all one line, for MakeMaker

which seems quite reasonable.

-- 
Paul Johnson - paulj@olsen.ch

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe