225 lines
5.3 KiB
HTML
225 lines
5.3 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of Dpkg::Control::HashCore</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>Dpkg::Control::HashCore</H1>
|
|
Section: libdpkg-perl (3perl)<BR>Updated: 2020-03-23<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
Dpkg::Control::HashCore - parse and manipulate a block of RFC822-like fields
|
|
<A NAME="lbAC"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
|
|
|
|
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.
|
|
<P>
|
|
|
|
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.
|
|
<P>
|
|
|
|
During parsing, trailing spaces are stripped on all lines while leading
|
|
spaces are stripped only on the first line of each field.
|
|
<A NAME="lbAD"> </A>
|
|
<H2>METHODS</H2>
|
|
|
|
|
|
|
|
<DL COMPACT>
|
|
<DT id="1">$c = Dpkg::Control::Hash->new(%opts)<DD>
|
|
|
|
|
|
|
|
|
|
Creates a new object with the indicated options. Supported options
|
|
are:
|
|
<DL COMPACT><DT id="2"><DD>
|
|
<DL COMPACT>
|
|
<DT id="3">allow_pgp<DD>
|
|
|
|
|
|
Configures the parser to accept OpenPGP signatures around the control
|
|
information. Value can be 0 (default) or 1.
|
|
<DT id="4">allow_duplicate<DD>
|
|
|
|
|
|
Configures the parser to allow duplicate fields in the control
|
|
information. Value can be 0 (default) or 1.
|
|
<DT id="5">drop_empty<DD>
|
|
|
|
|
|
Defines if empty fields are dropped during the output. Value can be 0
|
|
(default) or 1.
|
|
<DT id="6">name<DD>
|
|
|
|
|
|
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.
|
|
<DT id="7">is_pgp_signed<DD>
|
|
|
|
|
|
Set by the parser (starting in dpkg 1.17.0) if it finds an OpenPGP
|
|
signature around the control information. Value can be 0 (default)
|
|
or 1, and undef when the option is not supported by the code (in
|
|
versions older than dpkg 1.17.0).
|
|
</DL>
|
|
</DL>
|
|
|
|
<DL COMPACT><DT id="8"><DD>
|
|
</DL>
|
|
|
|
<DT id="9">$c->set_options($option, %opts)<DD>
|
|
|
|
|
|
|
|
|
|
Changes the value of one or more options.
|
|
<DT id="10">$value = $c->get_option($option)<DD>
|
|
|
|
|
|
|
|
|
|
Returns the value of the corresponding option.
|
|
<DT id="11">$c->parse_error($file, $fmt, ...)<DD>
|
|
|
|
|
|
|
|
|
|
Prints an error message and dies on syntax parse errors.
|
|
<DT id="12">$c->parse($fh, $description)<DD>
|
|
|
|
|
|
|
|
|
|
Parse a control file from the given filehandle. Exits in case of errors.
|
|
<TT>$description</TT> 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. When called multiple times, the parsed fields are accumulated.
|
|
|
|
|
|
<P>
|
|
|
|
|
|
Returns true if some fields have been parsed.
|
|
<DT id="13">$c->load($file)<DD>
|
|
|
|
|
|
|
|
|
|
Parse the content of <TT>$file</TT>. Exits in case of errors. Returns true if some
|
|
fields have been parsed.
|
|
<DT id="14">$c->find_custom_field($name)<DD>
|
|
|
|
|
|
|
|
|
|
Scan the fields and look for a user specific field whose name matches the
|
|
following regex: /X[<FONT SIZE="-1">SBC</FONT>]*-$name/i. Return the name of the field found or
|
|
undef if nothing has been found.
|
|
<DT id="15">$c->get_custom_field($name)<DD>
|
|
|
|
|
|
|
|
|
|
Identify a user field and retrieve its value.
|
|
<DT id="16">$str = $c-><B>output()</B><DD>
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="17">"$c"<DD>
|
|
|
|
|
|
|
|
|
|
|
|
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 <B>set_output_order()</B>.
|
|
<DT id="18">$c->output($fh)<DD>
|
|
|
|
|
|
|
|
|
|
Print the string representation of the control information to a
|
|
filehandle.
|
|
<DT id="19">$c->save($filename)<DD>
|
|
|
|
|
|
|
|
|
|
Write the string representation of the control information to a file.
|
|
<DT id="20">$c->set_output_order(@fields)<DD>
|
|
|
|
|
|
|
|
|
|
Define the order in which fields will be displayed in the <B>output()</B> method.
|
|
<DT id="21">$c->apply_substvars($substvars)<DD>
|
|
|
|
|
|
|
|
|
|
Update all fields by replacing the variables references with
|
|
the corresponding value stored in the Dpkg::Substvars object.
|
|
</DL>
|
|
<A NAME="lbAE"> </A>
|
|
<H2>CHANGES</H2>
|
|
|
|
|
|
|
|
<A NAME="lbAF"> </A>
|
|
<H3>Version 1.01 (dpkg 1.17.2)</H3>
|
|
|
|
|
|
|
|
New method: <TT>$c</TT>-><B>parse_error()</B>.
|
|
<A NAME="lbAG"> </A>
|
|
<H3>Version 1.00 (dpkg 1.17.0)</H3>
|
|
|
|
|
|
|
|
Mark the module as public.
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="22"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="23"><A HREF="#lbAC">DESCRIPTION</A><DD>
|
|
<DT id="24"><A HREF="#lbAD">METHODS</A><DD>
|
|
<DT id="25"><A HREF="#lbAE">CHANGES</A><DD>
|
|
<DL>
|
|
<DT id="26"><A HREF="#lbAF">Version 1.01 (dpkg 1.17.2)</A><DD>
|
|
<DT id="27"><A HREF="#lbAG">Version 1.00 (dpkg 1.17.0)</A><DD>
|
|
</DL>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:39 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|