{
    "mode": "perldoc",
    "parameter": "Dpkg::Version",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Dpkg%3A%3AVersion/json",
    "generated": "2026-06-12T13:36:04Z",
    "sections": {
        "NAME": {
            "content": "Dpkg::Version - handling and comparing dpkg-style version numbers\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The Dpkg::Version module provides pure-Perl routines to compare dpkg-style version numbers (as\nused in Debian packages) and also an object oriented interface overriding perl operators to do\nthe right thing when you compare Dpkg::Version object between them.\n",
            "subsections": []
        },
        "METHODS": {
            "content": "$v = Dpkg::Version->new($version, %opts)\nCreate a new Dpkg::Version object corresponding to the version indicated in the string\n(scalar) $version. By default it will accepts any string and consider it as a valid version.\nIf you pass the option \"check => 1\", it will return undef if the version is invalid (see\nversioncheck for details).\n\nYou can always call $v->isvalid() later on to verify that the version is valid.\n\nboolean evaluation\nWhen the Dpkg::Version object is used in a boolean evaluation (for example in \"if ($v)\" or\n\"$v ? \\\"$v\\\" : 'default'\") it returns true if the version stored is valid ($v->isvalid())\nand false otherwise.\n\nNotice: Between dpkg 1.15.7.2 and 1.19.1 this overload used to return $v->asstring() if\n$v->isvalid(), a breaking change in behavior that caused \"0\" versions to be evaluated as\nfalse. To catch any possibly intended code that relied on those semantics, this overload\nwill emit a warning with category \"Dpkg::Version::semanticchange::overload::bool\" until\ndpkg 1.20.x. Once fixed, or for already valid code the warning can be quiesced with\n\nno if $Dpkg::Version::VERSION ge '1.02',\nwarnings => qw(Dpkg::Version::semanticchange::overload::bool);\n\nadded after the \"use Dpkg::Version\".\n\n$v->isvalid()\nReturns true if the version is valid, false otherwise.\n\n$v->epoch(), $v->version(), $v->revision()\nReturns the corresponding part of the full version string.\n\n$v->isnative()\nReturns true if the version is native, false if it has a revision.\n\n$v1 <=> $v2, $v1 < $v2, $v1 <= $v2, $v1 > $v2, $v1 >= $v2\nNumerical comparison of various versions numbers. One of the two operands needs to be a\nDpkg::Version, the other one can be anything provided that its string representation is a\nversion number.\n\n\"$v\", $v->asstring(), $v->asstring(%options)\nAccepts an optional option hash reference, affecting the string conversion.\n\nOptions:\n\nomitepoch (defaults to 0)\nOmit the epoch, if present, in the output string.\n\nomitrevision (defaults to 0)\nOmit the revision, if present, in the output string.\n\nReturns the string representation of the version number.\n",
            "subsections": []
        },
        "FUNCTIONS": {
            "content": "All the functions are exported by default.\n",
            "subsections": [
                {
                    "name": "version_compare",
                    "content": "Returns -1 if $a is earlier than $b, 0 if they are equal and 1 if $a is later than $b.\n\nIf $a or $b are not valid version numbers, it dies with an error.\n"
                },
                {
                    "name": "version_compare_relation",
                    "content": "Returns the result (0 or 1) of the given comparison operation. This function is implemented\non top of versioncompare().\n\nAllowed values for $rel are the exported constants RELGT, RELGE, RELEQ, RELLE, RELLT.\nUse versionnormalizerelation() if you have an input string containing the operator.\n\n$rel = versionnormalizerelation($relstring)\nReturns the normalized constant of the relation $rel (a value among RELGT, RELGE, RELEQ,\nRELLE and RELLT). Supported relations names in input are: \"gt\", \"ge\", \"eq\", \"le\", \"lt\",\n\">>\", \">=\", \"=\", \"<=\", \"<<\". \">\" and \"<\" are also supported but should not be used as they\nare obsolete aliases of \">=\" and \"<=\".\n"
                },
                {
                    "name": "version_compare_string",
                    "content": "String comparison function used for comparing non-numerical parts of version numbers.\nReturns -1 if $a is earlier than $b, 0 if they are equal and 1 if $a is later than $b.\n\nThe \"~\" character always sort lower than anything else. Digits sort lower than non-digits.\nAmong remaining characters alphabetic characters (A-Z, a-z) sort lower than the other ones.\nWithin each range, the ASCII decimal value of the character is used to sort between\ncharacters.\n"
                },
                {
                    "name": "version_compare_part",
                    "content": "Compare two corresponding sub-parts of a version number (either upstream version or debian\nrevision).\n\nEach parameter is split by versionsplitdigits() and resulting items are compared together.\nAs soon as a difference happens, it returns -1 if $a is earlier than $b, 0 if they are equal\nand 1 if $a is later than $b.\n\n@items = versionsplitdigits($version)\nSplits a string in items that are each entirely composed either of digits or of non-digits.\nFor instance for \"1.024~beta1+svn234\" it would return (\"1\", \".\", \"024\", \"~beta\", \"1\",\n\"+svn\", \"234\").\n\n($ok, $msg) = versioncheck($version)\n$ok = versioncheck($version)\nChecks the validity of $version as a version number. Returns 1 in $ok if the version is\nvalid, 0 otherwise. In the latter case, $msg contains a description of the problem with the\n$version scalar.\n"
                }
            ]
        },
        "CHANGES": {
            "content": "Version 1.03 (dpkg 1.20.0)\nRemove deprecation warning from semantic change in 1.02.\n\nVersion 1.02 (dpkg 1.19.1)\nSemantic change: bool evaluation semantics restored to their original behavior.\n\nVersion 1.01 (dpkg 1.17.0)\nNew argument: Accept an options argument in $v->asstring().\n\nNew method: $v->isnative().\n\nVersion 1.00 (dpkg 1.15.6)\nMark the module as public.\n",
            "subsections": []
        }
    },
    "summary": "Dpkg::Version - handling and comparing dpkg-style version numbers",
    "flags": [],
    "examples": [],
    "see_also": []
}