Not found locally for Dpkg::Version. Try Google search
Dpkg::Version — handling and comparing dpkg-style version numbers
| Use Case | Command | Description |
|---|---|---|
| Create a version object | my $v = Dpkg::Version->new("1.2.3-1") | Parse a version string and return a new object |
| Compare two versions | $v1 $v2 or version_compare($a, $b) | Returns -1, 0, 1 for earlier, equal, later |
| Check if version is valid | $v->is_valid() or version_check($version) | Returns true if the version string is syntactically correct |
| Extract epoch | $v->epoch() | Returns the epoch part of the version |
| Extract upstream version | $v->version() | Returns the upstream version part |
| Extract revision | $v->revision() | Returns the Debian revision part |
| Test if native | $v->is_native() | Returns true if no revision is present |
| String representation | "$v" or $v->as_string() | Convert version to a string (optionally omit epoch/revision) |
The Dpkg::Version module provides pure-Perl routines to compare dpkg-style version numbers (as used in Debian packages) and also an object oriented interface overriding Perl operators to do the right thing when you compare Dpkg::Version objects between them.
Create a new Dpkg::Version object corresponding to the version indicated in the string (scalar) $version. By default it accepts any string and consider it as a valid version. If you pass the option check => 1, it will return undef if the version is invalid (see version_check for details).
You can always call $v->is_valid() later on to verify that the version is valid.
When the Dpkg::Version object is used in a boolean evaluation (for example in if ($v) or $v ? "$v" : 'default') it returns true if the version stored is valid ($v->is_valid()) and false otherwise.
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.
Returns true if the version is valid, false otherwise.
Returns the corresponding part of the full version string.
Returns true if the version is native, false if it has a revision.
Numerical comparison of various version numbers. One of the two operands needs to be a Dpkg::Version, the other one can be anything provided that its string representation is a version number.
Accepts an optional option hash reference, affecting the string conversion.
Options:
Returns the string representation of the version number.
All the functions are exported by default.
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.$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 sorts 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.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. 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.@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").($ok, $msg) = version_check($version) or $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.Remove deprecation warning from semantic change in 1.02.
Semantic change: bool evaluation semantics restored to their original behavior.
New argument: Accept an options argument in $v->as_string().
New method: $v->is_native().
Mark the module as public.
1.21.1 2025-09-09 Dpkg::Version(3perl)
Generated by phpman v4.10.0-7-g98e9fd5 Author: Che Dong Under GNU General Public License
2026-09-09 11:45 @2600:1f28:365:80b0:60b0:dfa5:fbc9:9f8f
CrawledBy CCBot/2.0 (https://commoncrawl.org/faq/)