Youri::Config - Youri configuration handler


Youri-Config documentation  | view source Contained in the Youri-Config distribution.

Index


NAME

Top

Youri::Config - Youri configuration handler

SYNOPSIS

Top

    use Youri::Config;

    my $app = Youri::Config->new(
        options => {
            help => '|h!'
        },
        directories => [ '/etc/youri', "$ENV{HOME}/.youri" ],
        file        => 'app.conf',
    );

    # get command line argument
    my $foo = $app->get_arg('foo');

    # get configuration file parameter
    my $bar = $app->get_param('bar');

DESCRIPTION

Top

This class handle configuration for all YOURI applications.

The command line specification is used to manage arguments through Getopt::Long. Unless --config argument is given, the list of directories is then scanned for a file with given name, and halt as soon as it find one. If no readable file is found, an exception is thrown. The file is then processed through YAML::AppConfig. If parsing fails, an exception is thrown.

CONFIGURATION FILE FORMAT

Top

SHARED KEYS

In addition to the application-specific optional or mandatory parameters, all YOURI applications support the following optional top-level parameters:

includes

A list of additional configuration files.

foo

An arbitrary variable, usable everywhere else in the file.

PLUGIN DEFINITION

All YOURI application heavily rely on plugins defined in their configuration files. A plugin definition is composed from the following parameters:

class

The class of this plugin.

options

The options of this plugin.

SEE ALSO

Top

YAML::AppConfig, Getopt::Long

new(%args)

Creates and returns a new Youri::Config object.

INSTANCE METHODS

Top

get_arg($arg)

Returns the command-line argument $arg.

get_param($param)

Returns the configuration file parameter $param.

COPYRIGHT AND LICENSE

Top


Youri-Config documentation  | view source Contained in the Youri-Config distribution.