Dpkg::Index.3perl man page
Dpkg::Index — generic index of control information This object represent a set of Dpkg::Control objects. Creates a new empty index. See set_options() for more details. 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 false for backwards compatibility, but it will change to true in dpkg 1.20.x). The index can only contain one item with a given key. The “get_key_func” function used depends on the type: Returns the type of control information stored. See the type parameter set during new(). Add a new item in the index. If the Reads the filehandle and creates all items parsed. When called multiple times, the parsed stanzas are accumulated. Returns the number of items parsed. Reads the file and creates all items parsed. Returns the number of items parsed. Handles compressed files transparently based on their extensions. 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. Returns the item identified by Returns the keys of items that matches all the criteria. The key of the Returns all the items that matches all the criteria. Remove the item identified by the given key. Returns and removes all the items that matches all the criteria. 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. 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. 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 Writes the content of the index in a file. Auto-compresses files based on their extensions. New option: Add new “unique_tuple_key” option to Mark the module as public.Description
Methods
$index
= Dpkg::Index->new(%opts)$index
->set_options(%opts)$index
->get_type()$index
->add($item, [$key])$key
parameter is omitted, the key will be generated with the get_key_func function (see set_options() for details).$index
->parse($fh, $desc
)$index
->load($file)$item
= $index
->new_item()$item
= $index
->get_by_key($key)$key
or undef.@keys
= $index
->get_keys(%criteria)%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)$index
->remove_by_key($key)@items
= $index
->remove(%criteria)$index
->merge($other_index, %opts
)$index
->sort(\&sortfunc)$str
= $index
->output([$fh])$fh
has been passed.$index
->save($file)Changes
Version 1.01 (dpkg 1.19.0)
$index
->set_options() to set better default “get_key_func” options, which will become the default behavior in 1.20.x.Version 1.00 (dpkg 1.15.6)
Info