Dpkg::Conf(3perl) libdpkg-perl Dpkg::Conf(3perl)

# [NAME](#NAME)

Dpkg::Conf - parse dpkg configuration files

# [DESCRIPTION](#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](#METHODS)

$conf = Dpkg::Conf-&gt;new(%opts)

Create a new Dpkg::Conf object.

Options:

[**allow\_short**](#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-&gt;**get\_options()**

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

$count = $conf-&gt;load($file)

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

$count = $conf-&gt;load\_system\_config($file)

Read options from a system configuration file.

Return the number of options parsed.

$count = $conf-&gt;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-&gt;load\_config($file)

Read options from system and user configuration files.

Return the number of options parsed.

$count = $conf-&gt;parse($fh)

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

Return the number of options parsed.

$conf-&gt;filter(%opts)

Filter the list of configuration options.

Options:

[**remove**](#remove)

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

[**keep**](#keep)

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

$string = "$conf"

Return a string representation of the content.

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

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

$conf-&gt;save($file)

Save the options in a file.

# [CHANGES](#CHANGES)

## [Version 1.04 (dpkg 1.20.0)](#Version_1.04_%28dpkg_1.20.0%29)

Remove croak: For 'format\_argv' in $conf-&gt;**filter()**.

Remove methods: $conf-&gt;**get()**, $conf-&gt;**set()**.

## [Version 1.03 (dpkg 1.18.8)](#Version_1.03_%28dpkg_1.18.8%29)

Obsolete option: 'format\_argv' in $conf-&gt;**filter()**.

Obsolete methods: $conf-&gt;**get()**, $conf-&gt;**set()**.

New methods: $conf-&gt;**load\_system\_config()**, $conf-&gt;**load\_system\_user()**, $conf-&gt;**load\_config()**.

## [Version 1.02 (dpkg 1.18.5)](#Version_1.02_%28dpkg_1.18.5%29)

New option: Accept new option 'format\_argv' in $conf-&gt;**filter()**.

New methods: $conf-&gt;**get()**, $conf-&gt;**set()**.

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

New method: $conf-&gt;**filter()**

## [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::Conf(3perl) from dpkg 1.23.11-r1 (Chainguard OS)
Source: https://git.dpkg.org/git/dpkg/dpkg.git
