.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Dpkg::Control::HashCore 3perl" .TH Dpkg::Control::HashCore 3perl "2022-09-01" "1.20.12" "libdpkg-perl" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Dpkg::Control::HashCore \- parse and manipulate a block of RFC822\-like fields .SH "DESCRIPTION" .IX Header "DESCRIPTION" The Dpkg::Control::Hash class 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. .PP 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 \&\*(L" .\*(R" (space + dot) while other lines are prefixed with a single space. .PP During parsing, trailing spaces are stripped on all lines while leading spaces are stripped only on the first line of each field. .SH "METHODS" .IX Header "METHODS" .ie n .IP "$c = Dpkg::Control::Hash\->new(%opts)" 4 .el .IP "\f(CW$c\fR = Dpkg::Control::Hash\->new(%opts)" 4 .IX Item "$c = Dpkg::Control::Hash->new(%opts)" Creates a new object with the indicated options. Supported options are: .RS 4 .IP "allow_pgp" 8 .IX Item "allow_pgp" Configures the parser to accept OpenPGP signatures around the control information. Value can be 0 (default) or 1. .IP "allow_duplicate" 8 .IX Item "allow_duplicate" Configures the parser to allow duplicate fields in the control information. Value can be 0 (default) or 1. .IP "drop_empty" 8 .IX Item "drop_empty" Defines if empty fields are dropped during the output. Value can be 0 (default) or 1. .IP "name" 8 .IX Item "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. .IP "is_pgp_signed" 8 .IX Item "is_pgp_signed" 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). .RE .RS 4 .RE .ie n .IP "$c\->set_options($option, %opts)" 4 .el .IP "\f(CW$c\fR\->set_options($option, \f(CW%opts\fR)" 4 .IX Item "$c->set_options($option, %opts)" Changes the value of one or more options. .ie n .IP "$value = $c\->get_option($option)" 4 .el .IP "\f(CW$value\fR = \f(CW$c\fR\->get_option($option)" 4 .IX Item "$value = $c->get_option($option)" Returns the value of the corresponding option. .ie n .IP "$c\->parse_error($file, $fmt, ...)" 4 .el .IP "\f(CW$c\fR\->parse_error($file, \f(CW$fmt\fR, ...)" 4 .IX Item "$c->parse_error($file, $fmt, ...)" Prints an error message and dies on syntax parse errors. .ie n .IP "$c\->parse($fh, $description)" 4 .el .IP "\f(CW$c\fR\->parse($fh, \f(CW$description\fR)" 4 .IX Item "$c->parse($fh, $description)" Parse a control file from the given filehandle. Exits in case of errors. \&\f(CW$description\fR 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. .Sp Returns true if some fields have been parsed. .ie n .IP "$c\->load($file)" 4 .el .IP "\f(CW$c\fR\->load($file)" 4 .IX Item "$c->load($file)" Parse the content of \f(CW$file\fR. Exits in case of errors. Returns true if some fields have been parsed. .ie n .IP "$c\->find_custom_field($name)" 4 .el .IP "\f(CW$c\fR\->find_custom_field($name)" 4 .IX Item "$c->find_custom_field($name)" Scan the fields and look for a user specific field whose name matches the following regex: /X[\s-1SBC\s0]*\-$name/i. Return the name of the field found or undef if nothing has been found. .ie n .IP "$c\->get_custom_field($name)" 4 .el .IP "\f(CW$c\fR\->get_custom_field($name)" 4 .IX Item "$c->get_custom_field($name)" Identify a user field and retrieve its value. .ie n .IP "$str = $c\->\fBoutput()\fR" 4 .el .IP "\f(CW$str\fR = \f(CW$c\fR\->\fBoutput()\fR" 4 .IX Item "$str = $c->output()" .PD 0 .ie n .IP """$c""" 4 .el .IP "``$c''" 4 .IX Item "$c" .PD 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 \fBset_output_order()\fR. .ie n .IP "$c\->output($fh)" 4 .el .IP "\f(CW$c\fR\->output($fh)" 4 .IX Item "$c->output($fh)" Print the string representation of the control information to a filehandle. .ie n .IP "$c\->save($filename)" 4 .el .IP "\f(CW$c\fR\->save($filename)" 4 .IX Item "$c->save($filename)" Write the string representation of the control information to a file. .ie n .IP "$c\->set_output_order(@fields)" 4 .el .IP "\f(CW$c\fR\->set_output_order(@fields)" 4 .IX Item "$c->set_output_order(@fields)" Define the order in which fields will be displayed in the \fBoutput()\fR method. .ie n .IP "$c\->apply_substvars($substvars)" 4 .el .IP "\f(CW$c\fR\->apply_substvars($substvars)" 4 .IX Item "$c->apply_substvars($substvars)" Update all fields by replacing the variables references with the corresponding value stored in the Dpkg::Substvars object. .SH "CHANGES" .IX Header "CHANGES" .SS "Version 1.01 (dpkg 1.17.2)" .IX Subsection "Version 1.01 (dpkg 1.17.2)" New method: \f(CW$c\fR\->\fBparse_error()\fR. .SS "Version 1.00 (dpkg 1.17.0)" .IX Subsection "Version 1.00 (dpkg 1.17.0)" Mark the module as public.