The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Youri::Config - Youri configuration handler

SYNOPSIS

    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

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

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

YAML::AppConfig, Getopt::Long

new(%args)

Creates and returns a new Youri::Config object.

INSTANCE METHODS

get_arg($arg)

Returns the command-line argument $arg.

get_param($param)

Returns the configuration file parameter $param.

COPYRIGHT AND LICENSE

Copyright (C) 2002-2006, YOURI project

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.