{
    "content": [
        {
            "type": "text",
            "text": "# Dpkg::Index (perldoc)\n\n## NAME\n\nDpkg::Index - generic index of control information\n\n## DESCRIPTION\n\nThis class represent a set of Dpkg::Control objects.\n\n## Sections\n\n- **NAME**\n- **DESCRIPTION**\n- **METHODS**\n- **CHANGES**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Dpkg::Index",
        "section": "",
        "mode": "perldoc",
        "summary": "Dpkg::Index - generic index of control information",
        "synopsis": null,
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 95,
                "subsections": []
            },
            {
                "name": "CHANGES",
                "lines": 13,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Dpkg::Index - generic index of control information\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This class represent a set of Dpkg::Control objects.\n",
                "subsections": []
            },
            "METHODS": {
                "content": "$index = Dpkg::Index->new(%opts)\nCreates a new empty index. See setoptions() for more details.\n\n$index->setoptions(%opts)\nThe \"type\" option is checked first to define default values for other options. Here are the\nrelevant options: \"getkeyfunc\" is a function returning a key for the item passed in\nparameters, \"uniquetuplekey\" is a boolean requesting whether the default key should be the\nunique tuple (default to true), \"itemopts\" is a hash reference that will be passed to the\nitem constructor in the newitem() method. The index can only contain one item with a given\nkey. The \"getkeyfunc\" function used depends on the type:\n\n*   for CTRLINFOSRC, it is the Source field;\n\n*   for CTRLINDEXSRC and CTRLPKGSRC it is the Package and Version fields (concatenated\nwith \"\") when \"uniquetuplekey\" is true (the default), or otherwise the Package field;\n\n*   for CTRLINFOPKG it is simply the Package field;\n\n*   for CTRLINDEXPKG and CTRLPKGDEB it is the Package, Version and Architecture fields\n(concatenated with \"\") when \"uniquetuplekey\" is true (the default) or otherwise the\nPackage field;\n\n*   for CTRLCHANGELOG it is the Source and the Version fields (concatenated with an\nintermediary \"\");\n\n*   for CTRLTESTS is either the Tests or Test-Command fields;\n\n*   for CTRLFILECHANGES it is the Source, Version and Architecture fields (concatenated\nwith \"\");\n\n*   for CTRLFILEVENDOR it is the Vendor field;\n\n*   for CTRLFILESTATUS it is the Package and Architecture fields (concatenated with \"\");\n\n*   otherwise it is the Package field by default.\n\n$index->gettype()\nReturns the type of control information stored. See the type parameter set during new().\n\n$index->add($item, [$key])\nAdd a new item in the index. If the $key parameter is omitted, the key will be generated\nwith the getkeyfunc function (see setoptions() for details).\n\n$index->parse($fh, $desc)\nReads the filehandle and creates all items parsed. When called multiple times, the parsed\nstanzas are accumulated.\n\nReturns the number of items parsed.\n\n$index->load($file)\nReads the file and creates all items parsed. Returns the number of items parsed. Handles\ncompressed files transparently based on their extensions.\n\n$item = $index->newitem()\nCreates a new item. Mainly useful for derived objects that would want to override this\nmethod to return something else than a Dpkg::Control object.\n\n$item = $index->getbykey($key)\nReturns the item identified by $key or undef.\n\n@keys = $index->getkeys(%criteria)\nReturns the keys of items that matches all the criteria. The key of the %criteria hash is a\nfield name and the value is either a regex that needs to match the field value, or a\nreference to a function that must return true and that receives the field value as single\nparameter, or a scalar that must be equal to the field value.\n\n@items = $index->get(%criteria)\nReturns all the items that matches all the criteria.\n\n$index->removebykey($key)\nRemove the item identified by the given key.\n\n@items = $index->remove(%criteria)\nReturns and removes all the items that matches all the criteria.\n\n$index->merge($otherindex, %opts)\nMerge the entries of the other index. While merging, the keys of the merged index are used,\nthey are not re-computed (unless you have set the options \"keepkeys\" to \"0\"). It's your\nresponsibility to ensure that they have been computed with the same function.\n\n$index->sort(\\&sortfunc)\nSort the index with the given sort function. If no function is given, an alphabetic sort is\ndone based on the keys. The sort function receives the items themselves as parameters and\nnot the keys.\n\n$str = $index->output([$fh])\n\"$index\"\nGet a string representation of the index. The Dpkg::Control objects are output in the order\nwhich they have been read or added except if the order have been changed with sort().\n\nPrint the string representation of the index to a filehandle if $fh has been passed.\n\n$index->save($file)\nWrites the content of the index in a file. Auto-compresses files based on their extensions.\n",
                "subsections": []
            },
            "CHANGES": {
                "content": "Version 2.01 (dpkg 1.20.6)\nNew option: Add new \"itemopts\" option.\n\nVersion 2.00 (dpkg 1.20.0)\nChange behavior: The \"uniquetuplekey\" option now defaults to true.\n\nVersion 1.01 (dpkg 1.19.0)\nNew option: Add new \"uniquetuplekey\" option to $index->setoptions() to set better default\n\"getkeyfunc\" options, which will become the default behavior in 1.20.x.\n\nVersion 1.00 (dpkg 1.15.6)\nMark the module as public.\n",
                "subsections": []
            }
        }
    }
}