SPUG: SVN $Rev$ and Perl $VERSION

David Dyck david.dyck at fluke.com
Mon Dec 12 23:32:47 PST 2005

On Mon, 12 Dec 2005 at 23:16 -0800, Michael R. Wolf <MichaelRWolf at att.net>...:

> What's the magic incantation to get a subversion $Rev$ keyword into a Perl
> $VERSION variable for use in the Build.PL or Makefile.PL?

a recent perl script under svn control here had this working:
 	our $VERSION = substr q$Revision: 56 $, 10;

> P.S.  For bonus points (and for the readers using CVS and other VC systems),
> please reply to the list with your favorite incantations, too....

the above should work with RCS/CVS also, although perldoc perlmod suggests:

             # if using RCS/CVS, this may be preferred
             $VERSION = sprintf "%d.%03d", q$Revision: 1.1 $ =~ /(\d+)/g;

More information about the spug-list mailing list