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

# [NAME](#NAME)

Dpkg::Control::Info - parse files like debian/control

# [DESCRIPTION](#DESCRIPTION)

It provides a class to access data of files that follow the same syntax as *debian/control*.

# [METHODS](#METHODS)

$ctrl\_tmpl = Dpkg::Control::Info-&gt;new(%opts)

Create a new Dpkg::Control::Info object. Loads *debian/control* by default. If a single scalar is passed, it will be used as the filename to load instead of the default. If filename is "-", it parses the standard input. If filename is undef no loading will be performed.

Options:

[**filename**](#filename)

Loads the file from the filename, instead of *debian/control*.

$ctrl\_tmpl-&gt;**reset()**

Resets what got read.

$ctrl\_tmpl-&gt;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 is used in error messages. The data in the object is reset before parsing new control files.

$ctrl\_tmpl-&gt;load($file)

Load the content of $file. Exits in case of errors. If file is "-", it loads from the standard input.

$ctrl = $ctrl\_tmpl-&gt;\[0]

$ctrl = $ctrl\_tmpl-&gt;**get\_source()**

Returns a Dpkg::Control object containing the fields concerning the source package.

$ctrl = $ctrl\_tmpl-&gt;get\_pkg\_by\_idx($idx)

Returns a Dpkg::Control object containing the fields concerning the binary package numbered $idx (starting at 1).

$ctrl = $ctrl\_tmpl-&gt;get\_pkg\_by\_name($name)

Returns a Dpkg::Control object containing the fields concerning the binary package named $name.

@ctrl\_list = $ctrl\_tmpl-&gt;**get\_packages()**

Returns a list containing the Dpkg::Control objects for all binary packages.

$string = "$ctrl\_tmpl"

Return a string representation of the content.

$string = $ctrl\_tmpl-&gt;output(\[$fh])

Return the content info into a string. If $fh is specified print it into the filehandle.

@ctrl\_list = @{$ctrl\_tmpl}

Return a list of Dpkg::Control objects, the first one is corresponding to source information and the following ones are the binary packages information.

# [CHANGES](#CHANGES)

## [Version 1.01 (dpkg 1.18.0)](#Version_1.01_%28dpkg_1.18.0%29)

New argument: The $c-&gt;**new()** constructor accepts an %opts argument.

## [Version 1.00 (dpkg 1.15.6)](#Version_1.00_%28dpkg_1.15.6%29)

Mark the module as public.

2026-09-09 1.23.11-dirty

---

Document: Dpkg::Control::Info(3perl) from dpkg 1.23.11-r2 (Chainguard OS)
Source: https://git.dpkg.org/git/dpkg/dpkg.git
