Author image Daniel Friesel
and 1 contributors

NAME

App::Slackeria::Config - Get config values for App::Slackeria and plugins

SYNOPSIS

    use App::Slackeria::Config;

    my $conf = App::Slackeria::Config->new();
    for my $name ($conf->plugins()) {
        my $plugin_conf = $conf->get('config', $name);
        # load plugin
    }
    for my $project ($conf->projects()) {
        for my $name ($conf->plugins()) {
            my $plugin_conf = $conf->get($project, $name);
            # run plugin
        }
    }

VERSION

version 0.12

DESCRIPTION

App::Slackeria::Config uses Config::Tiny(3pm) to load config files.

METHODS

$config = App::Slackeria::Config->new()

Returns a new App::Slackeria::Config object. Does not take any arguments.

$config->get($name, $section)

Returns a hashref containing the section of the config file name. If name does not exist or does not contain section, returns a reference to an empty hash. If name is not config and section does not have a name field, sets name to name in the hashref.

$config->load($name)

Loads $XDG_CONFIG_HOME/slackeria/name (defaulting to ~/.config/slackeria/name) and saves its content internally. If the config file does not exist, saves an empty hashref.

$config->get automatically calls this, so there should be no need for you to use it.

$config->projects()

Returns an array of all projects, as listed in the projects key in the slackeria section of the config file.

$config->plugins()

Returns an array of all plugins, which is actually just a list of all sections in the config file.

DEPENDENCIES

Config::Tiny, File::BaseDir.

SEE ALSO

slackeria(1)

AUTHOR

Copyright (C) 2011 by Daniel Friesel <derf@finalrewind.org>

LICENSE

  0. You just DO WHAT THE FUCK YOU WANT TO.