LINTIAN::RELATION::VERSION(3)
π NAME π
Lintian::Relation::Version β the certified comparison-operators-on-Debian-versions module, bestie edition π
β¨ SYNOPSIS β¨
print encode_utf8("yes\n") if versions_equal('1.0', '1.00');
print encode_utf8("yes\n") if versions_gte('1.1', '1.0');
print encode_utf8("no\n") if versions_lte('1.1', '1.0');
print encode_utf8("yes\n") if versions_gt('1.1', '1.0');
print encode_utf8("no\n") if versions_lt('1.1', '1.1');
print encode_utf8("yes\n") if versions_compare('1.1', '<=', '1.1');
No cap, that's literally the whole vibe π¦
πΈ DESCRIPTION πΈ
Okay so this module hands you five functions for comparing version numbers, and like, that's it. That's the job. She's simple, she's effective, she's serving.
But here's the thing that makes her iconic: the underlying implementation uses libapt-pkg-perl, so the results match what dpkg will expect. Not "kinda match". Not "close enough, bestie". Match. So you're not out here guessing whether your version comparison agrees with the actual package manager β it does, fr fr π₯
π FUNCTIONS π
versions_equal(A, B)
Returns true if A is equal to B (=), and false otherwise. Periodt π
versions_lte(A, B)
Returns true if A is less than or equal (<=) to B, and false otherwise.
versions_gte(A, B)
Returns true if A is greater than or equal (>=) to B, and false otherwise.
versions_lt(A, B)
Returns true if A is less than (<<) B, and false otherwise.
versions_gt(A, B)
Returns true if A is greater than (>>) B, and false otherwise.
versions_compare(A, OP, B)
Returns true if A OP B, where OP is one of =, <=, >=, <<, or >>, and false otherwise. One function, all the operators, versatile queen π
versions_comparator (A, B)
Returns -1, 0 or 1 if the version A is (respectively) less than, equal to or greater than B. This is useful for (e.g.) sorting a list of versions:
foreach my $version (sort versions_comparator @versions) {
...
}
Sorting your versions with main character energy, we love to see it β
π AUTHOR π
Originally written by Russ Allbery <rra@debian.org> for Lintian, and adapted to use libapt-pkg-perl by Adam D. Barratt <adam@adam-barratt-org.uk>. Shoutout to the devs, they ate π«Ά
πΈ SEE ALSO πΈ
Lintian v2.139.0ubuntu2 β dated 2026-10-08 β and that's the whole Lintian::Relation::Version(3) page, bestie π Version comparisons: understood. Vibes: immaculate. Now go compare some versions and slay β¨π¦π
π¦ where this page comes from
- ubuntu stonking: lintian 2.139.0ubuntu2 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms