---
name: "Dpkg::Conf"
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::Conf/3perl"
---

# Dpkg::Conf(3perl)

parse dpkg configuration files

## NAME

Dpkg::Conf - parse dpkg configuration files

## DESCRIPTION

The Dpkg::Conf object can be used to read options from a configuration file. It can export an array that can then be parsed exactly like `@ARGV`.

## METHODS

- $conf = Dpkg::Conf-\>new(%opts)

  Create a new Dpkg::Conf object.

  Options:

  - **allow\_short**

    If set to true (it defaults to false), then short options are allowed in the configuration file, they should be prepended with a single hyphen.

- @options = @{$conf}

  - @options = $conf-\>**get\_options()**

  Returns the list of options that can be parsed like `@ARGV`.

- $count = $conf-\>load($file)

  Read options from a file. Return the number of options parsed.

- $count = $conf-\>load\_system\_config($file)

  Read options from a system configuration file.

  Return the number of options parsed.

- $count = $conf-\>load\_user\_config($file)

  Read options from a user configuration file. It will try to use the XDG directory, either `$XDG_CONFIG_HOME`/dpkg/ or `$HOME`/.config/dpkg/.

  Return the number of options parsed.

- $conf-\>load\_config($file)

  Read options from system and user configuration files.

  Return the number of options parsed.

- $count = $conf-\>parse($fh)

  Parse options from a file handle. When called multiple times, the parsed options are accumulated.

  Return the number of options parsed.

- $conf-\>filter(%opts)

  Filter the list of configuration options.

  Options:

  - **remove**

    A function returning a boolean, used to decide whether to remove the configuration option, executed as `$opts`{remove}-\>($option).

  - **keep**

    A function returning a boolean, used to decide whether to keep the configuration option, executed as `$opts`{keep}-\>($option).

- $string = "$conf"

  Return a string representation of the content.

- $string = $conf-\>output(\[$fh\])

  Write the options in the given filehandle (if defined) and return a string representation of the content (that would be) written.

- $conf-\>save($file)

  Save the options in a file.

## CHANGES

### Version 1.04 (dpkg 1.20.0)

Remove croak: For 'format\_argv' in `$conf`-\>**filter()**.

Remove methods: `$conf`-\>**get()**, `$conf`-\>**set()**.

### Version 1.03 (dpkg 1.18.8)

Obsolete option: 'format\_argv' in `$conf`-\>**filter()**.

Obsolete methods: `$conf`-\>**get()**, `$conf`-\>**set()**.

New methods: `$conf`-\>**load\_system\_config()**, `$conf`-\>**load\_system\_user()**, `$conf`-\>**load\_config()**.

### Version 1.02 (dpkg 1.18.5)

New option: Accept new option 'format\_argv' in `$conf`-\>**filter()**.

New methods: `$conf`-\>**get()**, `$conf`-\>**set()**.

### Version 1.01 (dpkg 1.15.8)

New method: `$conf`-\>**filter()**

### Version 1.00 (dpkg 1.15.6)

Mark the module as public.
