---
name: "Tirex::Config"
section: "3pm"
platform: "linux"
package: "tirex"
version: "0.7.1-3+b2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Tirex::Config"
---

# Tirex::Config(3pm)

Configuration

## NAME

Tirex::Config - Configuration

## SYNOPSIS

```
 my $config_dir = $opts{'config'} || $Tirex::TIREX_CONFIGDIR;
 my $config_file = $config_dir . '/' . $Tirex::TIREX_CONFIGFILENAME;
 Tirex::Config::init($config_file);
 Tirex::Config::dump_to_syslog();
 my $some_var = Tirex::Config::get('some_option', $Tirex::SOME_OPTION);
```

## DESCRIPTION

Methods for reading the main Tirex configuration file (usually /etc/tirex/tirex.conf) and accessing the config options.

## METHODS

### init($configfilename \[,$prefix\])

Loads the given config file. Dies on failure. If `$prefix` is given, all keys are prepended with `$prefix` and a dot. Does not overwrite already loaded data.

### dump\_to\_syslog()

Dump config to syslog.

### get($key \[,$default \[, $pattern\]\])

Returns the value of config key `$key`, or `$default` if the value is unset.

If `$pattern` is available the value is checked against it. Will croak if it doesn't match.

### get\_int($key \[,$default\])

Returns the value of config key `$key` as integer, or `$default` if the value is unset.
