NAME

Module::New::Config

SYNOPSIS

my $config = Module::New::Config->new( file => 'config.yaml' );

my $value  = $config->get('some_key');
$config->set('some_key' => 'value');

$config->load;
$config->save;

DESCRIPTION

Used internally to get/set the config value.

METHODS

new

takes an optional hash, creates an object, and loads a configuration file if any (or creates one if none is found).

get

If you pass a key, returns a value for the key. Without a key, returns the whole configuration hash reference.

set

takes pairs of key/value and update the config (temporarily). If you want to keep the configuration, use save instead.

load

loads a configuration file written in YAML. The file is looked for in the current and home directory by default.

save

may take a hash to update, and saves the current configuration to a file.

file

returns the current config file.

get_options

takes Getopt::Long's specifications, parses @ARGV, and updates the current configuration.

AUTHOR

Kenichi Ishigaki, <ishigaki at cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2007-2009 by Kenichi Ishigaki.

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