DNSCheck::Config(3)

NAME
DNSCheck::Config - Read config files and make their contents available to other modules.

DESCRIPTION
Reads any config files, specified and/or default ones, stores their contents and provides methods that other modules can use to fetch them.

There are two distinct classes of configuration information, that reside in separate files. There is configuration, which modifies how things run. This is, for example, network timeouts, database connection information, file paths and such. In addition to this there is policy, which specifies things about the tests that get run. Most importantly, the policy information specifies the reported severity level of various test failures.

By default, "DNSCheck::Config" will load a default configuration and policy, which comes with the module. It will then look for an load local configuration and policy that can, if they exist, override the default setup. The local information will be looked for in the files /dnscheck/config.yaml and /dnscheck/policy.yaml. If that's not what you want, you can use the "configdir", "policydir", "configfile" and/or "policyfile" keys when creating the DNSCheck object to read config and policy from somewhere else.

There is no protection against having the same keys in the configuration and policy files. The configuration/policy distinction is entirely for human use, and if they want to put everything in the same bucket they're perfectly welcome to do so.

METHODS

->new(parameter => $value)
    The "new" method creates a new "DNSCheck::Config" object. It takes named parameters in the perl/Tk style (but without the initial dashes).

    The available parameters are these:

    configdir
        The path to the directory in which the module should look for configuration and policy files.

    configfile
        The full path to the configuration file.

    policyfile
        The full path to the policy file.

    locale
        The locale to be used for messages. This is supposed to be only a string with the locale, for example "en" or "sv". The actual filename will be figured out from that.

    localefile
        The full path to the actual YAML file holding the locale information to be used.

    interactive
        If this key is a true value, the logger object will be set to print entries to stdout as they are added, rather than store them for future use.

    extras
        A hashref with random stuff that'll be copied to the Config object.

->get($key)
    Simply returns whatever got read from the configuration or policy files under the given key.

->put($key, $value)
    Stores the given value for the given key.

->should_run()
    Returns true or false depending on if the calling method is disabled in the configuration or not. The default is to let it run.