- version_compare($a, $b)
-
Returns -1 if $a is earlier than $b, 0 if they are equal and 1 if $a
is later than $b.
If $a or $b are not valid version numbers, it dies with an error.
- version_compare_relation($a, $rel, $b)
-
Returns the result (0 or 1) of the given comparison operation. This
function is implemented on top of version_compare().
Allowed values for $rel are the exported constants REL_GT, REL_GE,
REL_EQ, REL_LE, REL_LT. Use version_normalize_relation() if you
have an input string containing the operator.
- my $rel = version_normalize_relation($rel_string)
-
Returns the normalized constant of the relation $rel (a value
among REL_GT, REL_GE, REL_EQ, REL_LE and REL_LT). Supported
relations names in input are: ``gt'', ``ge'', ``eq'', ``le'', ``lt'', ``>>'', ``>='',
``='', ``<='', ``<<''. ``>'' and ``<'' are also supported but should not be used as
they are obsolete aliases of ``>='' and ``<=''.
- version_compare_string($a, $b)
-
String comparison function used for comparing non-numerical parts of version
numbers. Returns -1 if $a is earlier than $b, 0 if they are equal and 1 if $a
is later than $b.
The ``~'' character always sort lower than anything else. Digits sort lower
than non-digits. Among remaining characters alphabetic characters (A-Za-z)
sort lower than the other ones. Within each range, the ASCII decimal value
of the character is used to sort between characters.
- version_compare_part($a, $b)
-
Compare two corresponding sub-parts of a version number (either upstream
version or debian revision).
Each parameter is split by version_split_digits() and resulting items
are compared together.in digits and non-digits items that are compared
together. As soon as a difference happens, it returns -1 if $a is earlier
than $b, 0 if they are equal and 1 if $a is later than $b.
- my @items = version_split_digits($version)
-
Splits a string in items that are each entirely composed either
of digits or of non-digits. For instance for ``1.024~beta1+svn234'' it would
return (``1'', ``.'', ``024'', ``~beta'', ``1'', ``+svn'', ``234'').
- my ($ok, $msg) = version_check($version)
-
- my $ok = version_check($version)
-
Checks the validity of $version as a version number. Returns 1 in $ok
if the version is valid, 0 otherwise. In the latter case, $msg
contains a description of the problem with the $version scalar.