1Dpkg::Index(3)                   libdpkg-perl                   Dpkg::Index(3)
2
3
4

NAME

6       Dpkg::Index - generic index of control information
7

DESCRIPTION

9       This object represent a set of Dpkg::Control objects.
10

METHODS

12       $index = Dpkg::Index->new(%opts)
13           Creates a new empty index. See set_options() for more details.
14
15       $index->set_options(%opts)
16           The "type" option is checked first to define default values for
17           other options. Here are the relevant options: "get_key_func" is a
18           function returning a key for the item passed in parameters. The
19           index can only contain one item with a given key. The function used
20           depends on the type: for CTRL_INFO_PKG, CTRL_INDEX_SRC,
21           CTRL_INDEX_PKG and CTRL_PKG_DEB it's simply the Package field; for
22           CTRL_PKG_SRC and CTRL_INFO_SRC, it's the Source field; for
23           CTRL_CHANGELOG it's the Source and the Version fields (concatenated
24           with an intermediary "_"); for CTRL_TESTS is either the Tests or
25           Test-Command fields; for CTRL_FILE_CHANGES it's the Source, Version
26           and Architecture fields (concatenated with "_"); for
27           CTRL_FILE_VENDOR it's the Vendor field; for CTRL_FILE_STATUS it's
28           the Package and Architecture fields (concatenated with "_").
29           Otherwise it's the Package field by default.
30
31       $index->get_type()
32           Returns the type of control information stored. See the type
33           parameter set during new().
34
35       $index->add($item, [$key])
36           Add a new item in the index. If the $key parameter is omitted, the
37           key will be generated with the get_key_func function (see
38           set_options() for details).
39
40       $index->load($file)
41           Reads the file and creates all items parsed. Returns the number of
42           items parsed. Handles compressed files transparently based on their
43           extensions.
44
45       $index->parse($fh, $desc)
46           Reads the filehandle and creates all items parsed. When called
47           multiple times, the parsed stanzas are accumulated.
48
49           Returns the number of items parsed.
50
51       $index->save($file)
52           Writes the content of the index in a file. Auto-compresses files
53           based on their extensions.
54
55       $item = $index->new_item()
56           Creates a new item. Mainly useful for derived objects that would
57           want to override this method to return something else than a
58           Dpkg::Control object.
59
60       $item = $index->get_by_key($key)
61           Returns the item identified by $key or undef.
62
63       @keys = $index->get_keys(%criteria)
64           Returns the keys of items that matches all the criteria. The key of
65           the %criteria hash is a field name and the value is either a regex
66           that needs to match the field value, or a reference to a function
67           that must return true and that receives the field value as single
68           parameter, or a scalar that must be equal to the field value.
69
70       @items = $index->get(%criteria)
71           Returns all the items that matches all the criteria.
72
73       $index->remove_by_key($key)
74           Remove the item identified by the given key.
75
76       @items = $index->remove(%criteria)
77           Returns and removes all the items that matches all the criteria.
78
79       $index->merge($other_index, %opts)
80           Merge the entries of the other index. While merging, the keys of
81           the merged index are used, they are not re-computed (unless you
82           have set the options "keep_keys" to "0"). It's your responsibility
83           to ensure that they have been computed with the same function.
84
85       $index->sort(\&sortfunc)
86           Sort the index with the given sort function. If no function is
87           given, an alphabetic sort is done based on the keys. The sort
88           function receives the items themselves as parameters and not the
89           keys.
90
91       $str = $index->output()
92       "$index"
93           Get a string representation of the index. The Dpkg::Control objects
94           are output in the order which they have been read or added except
95           if the order have been changed with sort().
96
97       $index->output($fh)
98           Print the string representation of the index to a filehandle.
99

CHANGES

101   Version 1.00 (dpkg 1.15.6)
102       Mark the module as public.
103
104
105
1061.18.25                           2018-06-26                    Dpkg::Index(3)
Impressum