version::Internals - Perl extension for Version Objects
Overloaded version objects for all modern versions of Perl. This documents the internal data representation and underlying code for version.pm. See version.pod for daily usage. This document is only useful for users interested in the gory details.
For the purposes of this module, a version "number" is a sequence of positive integer values separated by one or more decimal points and optionally a single underscore. This corresponds to what Perl itself uses for a version, as well as extending the "version as number" that is discussed in the various editions of the Camel book.
There are actually two distinct kinds of version objects:
Any version which "looks like a number", see "Decimal Versions". This also includes versions with a single decimal point and a single embedded underscore, see "Alpha Versions", even though these must be quoted to preserve the underscore formatting.
Also referred to as "Dotted-Integer", these contains more than one decimal point and may have an optional embedded underscore, see "Dotted-Decimal Versions". This is what is commonly used in most open source software as the "external" version (the one used as part of the tag or tarfile name). A leading 'v' character is now required and will warn if it missing.
Both of these methods will produce similar version objects, in that the default stringification will yield the version "Normal Form" only if required:
$v = version->new(1.002); # 1.002, but compares like 1.2.0
$v = version->new(1.002003); # 1.002003
$v2 = version->new("v1.2.3"); # v1.2.3
In specific, version numbers initialized as "Decimal Versions" will stringify as they were originally created (i.e. the same string that was passed to new()
. Version numbers initialized as "Dotted-Decimal Versions" will be stringified as