Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

dpkg::control::hash(3) [linux man page]

Dpkg::Control::Hash(3)						   libdpkg-perl 					    Dpkg::Control::Hash(3)

NAME
Dpkg::Control::Hash - parse and manipulate a block of RFC822-like fields DESCRIPTION
The Dpkg::Control::Hash object is a hash-like representation of a set of RFC822-like fields. The fields names are case insensitive and are always capitalized the same when output (see field_capitalize function in Dpkg::Control::Fields). The order in which fields have been set is remembered and is used to be able to dump back the same content. The output order can also be overridden if needed. You can store arbitrary values in the hash, they will always be properly escaped in the output to conform to the syntax of control files. This is relevant mainly for multilines values: while the first line is always output unchanged directly after the field name, supplementary lines are modified. Empty lines and lines containing only dots are prefixed with " ." (space + dot) while other lines are prefixed with a single space. During parsing, trailing spaces are stripped on all lines while leading spaces are stripped only on the first line of each field. FUNCTIONS
my $c = Dpkg::Control::Hash->new(%opts) Creates a new object with the indicated options. Supported options are: allow_pgp Configures the parser to accept PGP signatures around the control information. Value can be 0 (default) or 1. allow_duplicate Configures the parser to allow duplicate fields in the control information. Value can be 0 (default) or 1. drop_empty Defines if empty fields are dropped during the output. Value can be 0 (default) or 1. name The user friendly name of the information stored in the object. It might be used in some error messages or warnings. A default name might be set depending on the type. $c->set_options($option, %opts) Changes the value of one or more options. my $value = $c->get_option($option) Returns the value of the corresponding option. $c->load($file) Parse the content of $file. Exits in case of errors. Returns true if some fields have been parsed. $c->parse($fh, $description) Parse a control file from the given filehandle. Exits in case of errors. $description is used to describe the filehandle, ideally it's a filename or a description of where the data comes from. It's used in error messages. Returns true if some fields have been parsed. $c->find_custom_field($name) Scan the fields and look for a user specific field whose name matches the following regex: /X[SBC]*-$name/i. Return the name of the field found or undef if nothing has been found. $c->get_custom_field($name) Identify a user field and retrieve its value. $c->save($filename) Write the string representation of the control information to a file. my $str = $c->output() "$c" Get a string representation of the control information. The fields are sorted in the order in which they have been read or set except if the order has been overridden with set_output_order(). $c->output($fh) Print the string representation of the control information to a filehandle. $c->set_output_order(@fields) Define the order in which fields will be displayed in the output() method. $c->apply_substvars($substvars) Update all fields by replacing the variables references with the corresponding value stored in the Dpkg::Substvars object. AUTHOR
Raphael Hertzog <hertzog@debian.org>. 1.16.0.3 2012-04-17 Dpkg::Control::Hash(3)

Check Out this Related Man Page

Dpkg::Control(3)						   libdpkg-perl 						  Dpkg::Control(3)

NAME
Dpkg::Control - parse and manipulate official control-like information DESCRIPTION
The Dpkg::Control object is a smart version of Dpkg::Control::Hash. It associates a type to the control information. That type can be used to know what fields are allowed and in what order they must be output. The types are constants that are exported by default. Here's the full list: CTRL_UNKNOWN This type is the default type, it indicates that the type of control information is not yet known. CTRL_INFO_SRC Corresponds to the first block of information in a debian/control file in a Debian source package. CTRL_INFO_PKG Corresponds to subsequent blocks of information in a debian/control file in a Debian source package. CTRL_INDEX_SRC Corresponds to an entry in a Sources file of a source package repository. CTRL_INDEX_PKG Corresponds to an entry in a Packages file of a binary package repository. CTRL_PKG_SRC Corresponds to a .dsc file of a Debian source package. CTRL_PKG_DEB Corresponds to the control file generated by dpkg-gencontrol (DEBIAN/control) and to the same file inside .deb packages. CTRL_FILE_CHANGES Corresponds to a .changes file. CTRL_FILE_VENDOR Corresponds to a vendor file in /etc/dpkg/origins/. CTRL_FILE_STATUS Corresponds to an entry in dpkg's status file (/var/lib/dpkg/status). CTRL_CHANGELOG Corresponds to the output of dpkg-parsechangelog. FUNCTIONS
All the methods of Dpkg::Control::Hash are available. Those listed below are either new or overridden with a different behaviour. my $c = Dpkg::Control->new(%opts) If the "type" option is given, it's used to setup default values for other options. See set_options() for more details. $c->set_options(%opts) Changes the value of one or more options. If the "type" option is changed, it is used first to define default values for others options. The option "allow_pgp" is set to 1 for CTRL_PKG_SRC and CTRL_FILE_CHANGES and to 0 otherwise. The option "drop_empty" is set to 0 for CTRL_INFO_PKG and CTRL_INFO_SRC and to 1 otherwise. The option "name" is set to a textual description of the type of control information. The output order is also set to match the ordered list returned by Dpkg::Control::Fields::field_ordered_list($type). $c->get_type() Returns the type of control information stored. See the type parameter set during new(). AUTHOR
Raphael Hertzog <hertzog@debian.org>. 1.16.15 2014-06-05 Dpkg::Control(3)
Man Page