info > Dpkg::Version

Not found locally for Dpkg::Version. Try Google search

📛 NAME

Dpkg::Version — handling and comparing dpkg-style version numbers

🚀 Quick Reference

Use CaseCommandDescription
Create a version objectmy $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)

📖 DESCRIPTION

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.

🔧 METHODS

📦 $v = Dpkg::Version->new($version, %opts)

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.

🔍 Boolean evaluation

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.

✅ $v->is_valid()

Returns true if the version is valid, false otherwise.

📐 $v->epoch(), $v->version(), $v->revision()

Returns the corresponding part of the full version string.

🏠 $v->is_native()

Returns true if the version is native, false if it has a revision.

⚖️ $v1 <=> $v2, $v1 < $v2, $v1 <= $v2, $v1 > $v2, $v1 >= $v2

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.

📄 "$v", $v->as_string(), $v->as_string(%options)

Accepts an optional option hash reference, affecting the string conversion.

Options:

Returns the string representation of the version number.

🔬 FUNCTIONS

All the functions are exported by default.

📜 CHANGES

➡️ Version 1.03 (dpkg 1.20.0)

Remove deprecation warning from semantic change in 1.02.

➡️ Version 1.02 (dpkg 1.19.1)

Semantic change: bool evaluation semantics restored to their original behavior.

➡️ Version 1.01 (dpkg 1.17.0)

New argument: Accept an options argument in $v->as_string().

New method: $v->is_native().

➡️ Version 1.00 (dpkg 1.15.6)

Mark the module as public.

1.21.1 2025-09-09 Dpkg::Version(3perl)

Dpkg::Version
📛 NAME 🚀 Quick Reference 📖 DESCRIPTION 🔧 METHODS
📦 $v = Dpkg::Version->new($version, %opts) 🔍 Boolean evaluation ✅ $v->is_valid() 📐 $v->epoch(), $v->version(), $v->revision() 🏠 $v->is_native() ⚖️ $v1 <=> $v2, $v1 < $v2, $v1 <= $v2, $v1 > $v2, $v1 >= $v2 📄 "$v", $v->as_string(), $v->as_string(%options)
🔬 FUNCTIONS 📜 CHANGES
➡️ Version 1.03 (dpkg 1.20.0) ➡️ Version 1.02 (dpkg 1.19.1) ➡️ Version 1.01 (dpkg 1.17.0) ➡️ Version 1.00 (dpkg 1.15.6)

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/)
Valid XHTML 1.0 Transitional!Valid CSS!