---
name: "Dpkg::Control::Info"
section: "3perl"
platform: "linux"
package: "dpkg"
version: "1.23.11-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/Dpkg::Control::Info/3perl"
---

# Dpkg::Control::Info(3perl)

parse files like debian/control

## NAME

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

## DESCRIPTION

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

## METHODS

- $ctrl\_tmpl = Dpkg::Control::Info-\>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**

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

- $ctrl\_tmpl-\>**reset()**

  Resets what got read.

- $ctrl\_tmpl-\>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-\>load($file)

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

- $ctrl = $ctrl\_tmpl-\>\[0\]

  - $ctrl = $ctrl\_tmpl-\>**get\_source()**

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

- $ctrl = $ctrl\_tmpl-\>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-\>get\_pkg\_by\_name($name)

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

- @ctrl\_list = $ctrl\_tmpl-\>**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-\>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

### Version 1.01 (dpkg 1.18.0)

New argument: The `$c`-\>**new()** constructor accepts an `%opts` argument.

### Version 1.00 (dpkg 1.15.6)

Mark the module as public.
