{
    "mode": "perldoc",
    "parameter": "Dpkg::Substvars",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Dpkg%3A%3ASubstvars/json",
    "generated": "2026-06-12T12:41:08Z",
    "sections": {
        "NAME": {
            "content": "Dpkg::Substvars - handle variable substitution in strings\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "It provides a class which is able to substitute variables in strings.\n",
            "subsections": []
        },
        "METHODS": {
            "content": "$s = Dpkg::Substvars->new($file)\nCreate a new object that can do substitutions. By default it contains generic\nsubstitutions like ${Newline}, ${Space}, ${Tab}, ${dpkg:Version} and\n${dpkg:Upstream-Version}.\n\nAdditional substitutions will be read from the $file passed as parameter.\n\nIt keeps track of which substitutions were actually used (only counting substvars(), not\nget()), and warns about unused substvars when asked to. The substitutions that are\nalways present are not included in these warnings.\n\n$s->set($key, $value)\nAdd/replace a substitution.\n\n$s->setasused($key, $value)\nAdd/replace a substitution and mark it as used (no warnings will be produced even if\nunused).\n\n$s->setasauto($key, $value)\nAdd/replace a substitution and mark it as used and automatic (no warnings will be\nproduced even if unused).\n\n$s->get($key)\nGet the value of a given substitution.\n\n$s->delete($key)\nRemove a given substitution.\n\n$s->markasused($key)\nPrevents warnings about a unused substitution, for example if it is provided by default.\n\n$s->parse($fh, $desc)\nAdd new substitutions read from the filehandle. $desc is used to identify the filehandle\nin error messages.\n\nReturns the number of substitutions that have been parsed with success.\n\n$s->load($file)\nAdd new substitutions read from $file.\n\n$s->setversionsubstvars($sourceversion, $binaryversion)\nDefines ${binary:Version}, ${source:Version} and ${source:Upstream-Version} based on the\ngiven version strings.\n\nThese will never be warned about when unused.\n\n$s->setarchsubstvars()\nDefines architecture variables: ${Arch}.\n\nThis will never be warned about when unused.\n\n$s->setvendorsubstvars()\nDefines vendor variables: ${vendor:Name} and ${vendor:Id}.\n\nThese will never be warned about when unused.\n\n$s->setdescsubstvars()\nDefines source description variables: ${source:Synopsis} and\n${source:Extended-Description}.\n\nThese will never be warned about when unused.\n\n$s->setfieldsubstvars($ctrl, $prefix)\nDefines field variables from a Dpkg::Control object, with each variable having the form\n\"${$prefix:$field}\".\n\nThey will never be warned about when unused.\n\n$newstring = $s->substvars($string)\nSubstitutes variables in $string and return the result in $newstring.\n\n$s->warnaboutunused()\nIssues warning about any variables that were set, but not used.\n\n$s->setmsgprefix($prefix)\nDefine a prefix displayed before all warnings/error messages output by the module.\n\n$s->filter(remove => $rmfunc)\n$s->filter(keep => $keepfun)\nFilter the substitution variables, either removing or keeping all those that return true\nwhen $rmfunc->($key) or $keepfunc->($key) is called.\n\n\"$s\"    Return a string representation of all substitutions variables except the automatic ones.\n\n$str = $s->output([$fh])\nReturn all substitutions variables except the automatic ones. If $fh is passed print\nthem into the filehandle.\n\n$s->save($file)\nStore all substitutions variables except the automatic ones in the indicated file.\n",
            "subsections": []
        },
        "CHANGES": {
            "content": "Version 2.00 (dpkg 1.20.0)\nRemove method: $s->nowarn().\n\nNew method: $s->setvendorsubstvars().\n\nVersion 1.06 (dpkg 1.19.0)\nNew method: $s->setdescsubstvars().\n\nVersion 1.05 (dpkg 1.18.11)\nObsolete substvar: Emit an error on Source-Version substvar usage.\n\nNew return: $s->parse() now returns the number of parsed substvars.\n\nNew method: $s->setfieldsubstvars().\n\nVersion 1.04 (dpkg 1.18.0)\nNew method: $s->filter().\n\nVersion 1.03 (dpkg 1.17.11)\nNew method: $s->setasauto().\n\nVersion 1.02 (dpkg 1.16.5)\nNew argument: Accept a $binaryversion in $s->setversionsubstvars(), passing a single argument\nis still supported.\n\nNew method: $s->markasused().\n\nDeprecated method: $s->nowarn(), use $s->markasused() instead.\n\nVersion 1.01 (dpkg 1.16.4)\nNew method: $s->setasused().\n\nVersion 1.00 (dpkg 1.15.6)\nMark the module as public.\n",
            "subsections": []
        }
    },
    "summary": "Dpkg::Substvars - handle variable substitution in strings",
    "flags": [],
    "examples": [],
    "see_also": []
}