|Just another Perl shrine|
Best Practice for automatic version numbers?by kyle (Abbot)
|on Oct 06, 2007 at 02:59 UTC||Need Help??|
kyle has asked for the
wisdom of the Perl Monks concerning the following question:
After a romp through some SuperSearch results (and a read through Perl Best Practices), I wound up coding my $VERSION like this:
...where $Revision: 1.1 $ is something that's maintained for me by the revision control system I'm using.
Recently, I decided to start using git for revision control (having written some Perl to replay my old history into it). Since git is distributed, it really can't give me revision numbers in files like CVS can, so I'm looking for a new way forward.
I'm far too lazy to remember to update one of those numbers every time I touch a module, but I would like them to stay up-to-date. How do others handle this? How do you get a worthwhile version number into your programs and modules without any discipline or other noticeable effort?
The only solution I've thought of is a local commit script. It would determine which files have changed since the last commit and update their version numbers before running a git commit. This wouldn't be too hard to implement, and the habit of using it wouldn't be hard to form. Even so, I'm wondering if there is an even better way. Can I slip in another few lines in place of my $Revision$ hack and get what I want?
All your wisdom will be greatly appreciated.