ActiveState::Version - Utility functions for version comparison
use ActiveState::Version qw(vgt veq vcmp);
my $x = "0.9.9_beta"; my $y = "0.10"; my $z = "0.1";
print "$x is ", (vgt($x, y) ? "greater" : "less or equal"), "than $y.\n"; print "$y and $z are ", (veq($y, $z) ? "" : " not "), "equal.\n";
my @sorted = sort { vcmp($a, $b) } ($x, $y, $z);
print "The newest version is $sorted[-1].\n";
Handy utilities for uniform version comparison across various ActiveState applications.
Provides vcmp
, vge
, vgt
, vle
, vlt
, veq
, all
of which perform comparisons equivalent to the similarly named
perl operators.
Also provides the vnumify
function which turns any version string
to a floating point number. For version strings that are gibberish it
returns 0.