Not found locally for Dpkg::Index. Try Google search
Dpkg::Index - generic index of control information
| Use Case | Command | Description |
|---|---|---|
| Create a new index | Dpkg::Index->new(%opts) | Creates a new empty index with optional options. |
| Add an item | $index->add($item, [$key]) | Add an item to the index; key auto-generated if omitted. |
| Parse a filehandle | $index->parse($fh, $desc) | Reads filehandle and creates all items. |
| Load a file | $index->load($file) | Reads file (supports compressed) and creates items. |
| Retrieve by key | $index->get_by_key($key) | Get item by key or undef. |
| Get keys matching criteria | $index->get_keys(%criteria) | Returns keys of items matching field/value criteria. |
| Get items matching criteria | $index->get(%criteria) | Returns all items matching criteria. |
| Remove by key | $index->remove_by_key($key) | Remove item identified by key. |
| Remove items matching criteria | $index->remove(%criteria) | Returns and removes items matching criteria. |
| Merge another index | $index->merge($other_index, %opts) | Merge entries from another index. |
| Sort the index | $index->sort(\&sortfunc) | Sort items; defaults to alphabetic by key. |
| Output as string | $index->output([$fh]) | Get string representation; optionally print to filehandle. |
| Save to file | $index->save($file) | Write index to file (auto-compressed). |
This class represent a set of Dpkg::Control objects.
$index = Dpkg::Index->new(%opts) — Creates a new empty index. See set_options() for more details.$index->set_options(%opts) — The "type" option is checked first to define default values for other options. Here are the relevant options: "get_key_func" is a function returning a key for the item passed in parameters, "unique_tuple_key" is a boolean requesting whether the default key should be the unique tuple (default to true), "item_opts" is a hash reference that will be passed to the item constructor in the new_item() method. The index can only contain one item with a given key. The "get_key_func" function used depends on the type:
$index->get_type() — Returns the type of control information stored. See the type parameter set during new().$index->add($item, [$key]) — Add a new item in the index. If the $key parameter is omitted, the key will be generated with the get_key_func function (see set_options() for details).$index->parse($fh, $desc) — Reads the filehandle and creates all items parsed. When called multiple times, the parsed stanzas are accumulated. Returns the number of items parsed.$index->load($file) — Reads the file and creates all items parsed. Returns the number of items parsed. Handles compressed files transparently based on their extensions.$item = $index->new_item() — Creates a new item. Mainly useful for derived objects that would want to override this method to return something else than a Dpkg::Control object.$item = $index->get_by_key($key) — Returns the item identified by $key or undef.@keys = $index->get_keys(%criteria) — Returns the keys of items that matches all the criteria. The key of the %criteria hash is a field name and the value is either a regex that needs to match the field value, or a reference to a function that must return true and that receives the field value as single parameter, or a scalar that must be equal to the field value.@items = $index->get(%criteria) — Returns all the items that matches all the criteria.$index->remove_by_key($key) — Remove the item identified by the given key.@items = $index->remove(%criteria) — Returns and removes all the items that matches all the criteria.$index->merge($other_index, %opts) — Merge the entries of the other index. While merging, the keys of the merged index are used, they are not re-computed (unless you have set the options "keep_keys" to "0"). It's your responsibility to ensure that they have been computed with the same function.$index->sort(\&sortfunc) — Sort the index with the given sort function. If no function is given, an alphabetic sort is done based on the keys. The sort function receives the items themselves as parameters and not the keys.$str = $index->output([$fh]) / "$index" — Get a string representation of the index. The Dpkg::Control objects are output in the order which they have been read or added except if the order have been changed with sort(). Print the string representation of the index to a filehandle if $fh has been passed.$index->save($file) — Writes the content of the index in a file. Auto-compresses files based on their extensions.New option: Add new "item_opts" option.
Change behavior: The "unique_tuple_key" option now defaults to true.
New option: Add new "unique_tuple_key" option to $index->set_options() to set better default "get_key_func" options, which will become the default behavior in 1.20.x.
Mark the module as public.
1.21.1 2025-09-09 Dpkg::Index(3perl)
Generated by phpman v4.10.0-7-g98e9fd5 Author: Che Dong Under GNU General Public License
2026-09-09 12:24 @2600:1f28:365:80b0:60b0:dfa5:fbc9:9f8f
CrawledBy CCBot/2.0 (https://commoncrawl.org/faq/)