Eric Wilhelm and I have a friendly, but long running debate over the wisdom of using pure v-strings for Perl module version numbers. We just discovered that behind our difference of opinion is actually a technical difference: I use a 64 bit perl and he doesn’t.
The test case I usually cite has a module with a v-string version like this:
package Foo; use strict; use warnings; our $VERSION = v0.1.1; 1;
Since people are often taught to require minimum versions in decimal format instead of v-string format (e.g. “use 5.006” instead of “use v5.6.0”), I want to know that v-string version numbers work as expected, even if someone says “use Foo 0.001001”.
On Perl 5.10 or if version.pm has been loaded, all is well. But on earlier Perls, compiling for 64-bits produces a very different result:
$ perl5.8.9-32bit -e 'use Foo 0.001001' $ perl5.8.9-64bit -e 'use Foo 0.001001' Foo version 0.001001 required--this is only version 0.001001 at -e line 1. BEGIN failed--compilation aborted at -e line 1.
Apparently, the comparison between mixed version types is numeric and, with 64-bit precision, the conversion between v-string and decimal format gives unequal values and the version test fails.
Lesson: always test a module’s version in use() with the same format it has in $VERSION.
Corollary: if you want people to follow the rule above consistently, never change version number styles once a module is published.