|Perl Monk, Perl Meditation|
$VERSION Archeologyby bsb (Priest)
|on Jul 08, 2008 at 13:42 UTC||Need Help??|
I and others have asked about $VERSION numbers and updating them automatically. After noticing YAWTDI, I decided to investigate the different $VERSION styles found in the wild (where "in the wild" means on a machine of mine).
The top ten (semi-canonical form) from a total of 4707.
The first caveat is that there's a lot of "unique" lines with comments. Another caveat is that there may be build systems filling in $VERSION before deployment. Finally, there are some exotic forms (package vars and glob assignments) not included.The longest line was in Perl/Tidy.pm (excluding the comments)
A few observations. The basic $VERSION = "1.01" is the most popular by far. There's still many keyword expanded $Revision$s parsed into a $VERSION (158). About the same number append $Revision$, $Id$ or $Date$ in a comment.
Despite it's presence in Module/Starter/PBP.pm (twice), qv() versions haven't really taken off (use version; $VERSION = qv('0.0.3')). Similarly, bare \d.\d.\d versions are rare, as are fully-qualified package versions, glob assignments and "alpha" suffixes.
Performing the ExtUtils::MakeMaker eval reveals that the most common version is 0.01. The most common format is \d.\d\d (3025), next is \d.\d\d\d (433), then v\d.\d.\d (216).
I quite like the SVK solution for app-wide versions:
Although the possibility of arbitrary code running on a version evaluation is a little troubling.Some other interesting versions are:
Some modules wrap the $VERSION assignment in either a BEGIN or (as we do) a use param:
Any I've missed in my sample?