1Dpkg::Control::HashCore(3perl)   libdpkg-perl   Dpkg::Control::HashCore(3perl)
2
3
4

NAME

6       Dpkg::Control::HashCore - parse and manipulate a block of RFC822-like
7       fields
8

DESCRIPTION

10       The Dpkg::Control::Hash class is a hash-like representation of a set of
11       RFC822-like fields. The fields names are case insensitive and are
12       always capitalized the same when output (see field_capitalize function
13       in Dpkg::Control::Fields).  The order in which fields have been set is
14       remembered and is used to be able to dump back the same content. The
15       output order can also be overridden if needed.
16
17       You can store arbitrary values in the hash, they will always be
18       properly escaped in the output to conform to the syntax of control
19       files. This is relevant mainly for multilines values: while the first
20       line is always output unchanged directly after the field name,
21       supplementary lines are modified. Empty lines and lines containing only
22       dots are prefixed with " ." (space + dot) while other lines are
23       prefixed with a single space.
24
25       During parsing, trailing spaces are stripped on all lines while leading
26       spaces are stripped only on the first line of each field.
27

METHODS

29       $c = Dpkg::Control::Hash->new(%opts)
30           Creates a new object with the indicated options. Supported options
31           are:
32
33           allow_pgp
34                   Configures the parser to accept OpenPGP signatures around
35                   the control information. Value can be 0 (default) or 1.
36
37           allow_duplicate
38                   Configures the parser to allow duplicate fields in the
39                   control information. Value can be 0 (default) or 1.
40
41           drop_empty
42                   Defines if empty fields are dropped during the output.
43                   Value can be 0 (default) or 1.
44
45           name    The user friendly name of the information stored in the
46                   object. It might be used in some error messages or
47                   warnings. A default name might be set depending on the
48                   type.
49
50           is_pgp_signed
51                   Set by the parser (starting in dpkg 1.17.0) if it finds an
52                   OpenPGP signature around the control information. Value can
53                   be 0 (default) or 1, and undef when the option is not
54                   supported by the code (in versions older than dpkg 1.17.0).
55
56       $c->set_options($option, %opts)
57           Changes the value of one or more options.
58
59       $value = $c->get_option($option)
60           Returns the value of the corresponding option.
61
62       $c->parse_error($file, $fmt, ...)
63           Prints an error message and dies on syntax parse errors.
64
65       $c->parse($fh, $description)
66           Parse a control file from the given filehandle. Exits in case of
67           errors.  $description is used to describe the filehandle, ideally
68           it's a filename or a description of where the data comes from. It's
69           used in error messages. When called multiple times, the parsed
70           fields are accumulated.
71
72           Returns true if some fields have been parsed.
73
74       $c->load($file)
75           Parse the content of $file. Exits in case of errors. Returns true
76           if some fields have been parsed.
77
78       $c->find_custom_field($name)
79           Scan the fields and look for a user specific field whose name
80           matches the following regex: /X[SBC]*-$name/i. Return the name of
81           the field found or undef if nothing has been found.
82
83       $c->get_custom_field($name)
84           Identify a user field and retrieve its value.
85
86       $str = $c->output()
87       "$c"
88           Get a string representation of the control information. The fields
89           are sorted in the order in which they have been read or set except
90           if the order has been overridden with set_output_order().
91
92       $c->output($fh)
93           Print the string representation of the control information to a
94           filehandle.
95
96       $c->save($filename)
97           Write the string representation of the control information to a
98           file.
99
100       $c->set_output_order(@fields)
101           Define the order in which fields will be displayed in the output()
102           method.
103
104       $c->apply_substvars($substvars)
105           Update all fields by replacing the variables references with the
106           corresponding value stored in the Dpkg::Substvars object.
107

CHANGES

109   Version 1.01 (dpkg 1.17.2)
110       New method: $c->parse_error().
111
112   Version 1.00 (dpkg 1.17.0)
113       Mark the module as public.
114
115
116
1171.20.9                            2021-05-10    Dpkg::Control::HashCore(3perl)
Impressum