You can always call $v->is_valid() later on to verify that the version is valid.
Notice: Between dpkg 1.15.7.2 and 1.19.1 this overload used to return $v->as_string() if $v->is_valid(), a breaking change in behavior that caused ``0'' versions to be evaluated as false. To catch any possibly intended code that relied on those semantics, this overload will emit a warning with category ``Dpkg::Version::semantic_change::overload::bool'' until dpkg 1.20.x. Once fixed, or for already valid code the warning can be quiesced with
no if $Dpkg::Version::VERSION ge '1.02', warnings => qw(Dpkg::Version::semantic_change::overload::bool);
added after the "use Dpkg::Version".
Options:
Returns the string representation of the version number.
If $a or $b are not valid version numbers, it dies with an error.
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.
The ``~'' character always sort lower than anything else. Digits sort lower than non-digits. Among remaining characters alphabetic characters (A-Z, a-z) sort lower than the other ones. Within each range, the ASCII decimal value of the character is used to sort between characters.
Each parameter is split by version_split_digits() and resulting items 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.