DragonFly On-Line Manual Pages
Dpkg::Index(3) libdpkg-perl Dpkg::Index(3)
Dpkg::Index - generic index of control information
This object represent a set of Dpkg::Control objects.
$index = Dpkg::Index->new(%opts)
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. The
index can only contain one item with a given key. The function used
depend on the type: for CTRL_INFO_PKG, CTRL_INDEX_SRC,
CTRL_INDEX_PKG and CTRL_PKG_DEB it's simply the Package field; for
CTRL_PKG_SRC and CTRL_INFO_SRC, it's the Source field; for
CTRL_CHANGELOG it's the Source and the Version fields (concatenated
with an intermediary "_"); for CTRL_FILE_CHANGES it's the Source,
Version and Architecture fields (concatenated with "_"); for
CTRL_FILE_VENDOR it's the Vendor field; for CTRL_FILE_STATUS it's
the Package and Architecture fields (concatenated with "_").
Otherwise it's the Package field by default.
Returns the type of control information stored. See the type
parameter set during new().
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).
Reads the file and creates all items parsed. Returns the number of
items parsed. Handles compressed files transparently based on their
Reads the filehandle and creates all items parsed. Returns the
number of items parsed.
Writes the content of the index in a file. Auto-compresses files
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
$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.
Remove the item identified by the given key.
@items = $index->remove(%criteria)
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
$str = $index->output()
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 hae been changed with sort().
Print the string representation of the index to a filehandle.
Version 1.00 (dpkg 1.15.6)
Mark the module as public.
Raphael Hertzog <email@example.com>.
1.18.4 2015-11-26 Dpkg::Index(3)