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

NAME

BusyBird::Config - configuration holder for BusyBird

DESCRIPTION

This is an internal module. End-users should not use it.

BusyBird::Config is a simple configuration holder for BusyBird.

  • It emits warning via BusyBird::Log if unknown configuration parameter is set. This helps users find typo.

  • If with_default option is enabled, it lazily creates and returns the default value when get_config() is called.

CLASS METHODS

$con = BusyBird::Config->new(%args)

The constructor.

Fields in %args are:

type => STR (mandatory)

Type of the configuration. Either "global" or "timeline".

with_default => BOOL (mandatory)

If set to true, it lazily creates and returns the default value when get_config() is called on a known but not-yet-set parameter.

OBJECT METHODS

$param = $con->get_config($key)

Returns the value of the config parameter named $key.

If the value for $key is already set by set_config() method, it returns that value.

Otherwise, if with_default option is enabled and the default value for $key is prepared, it returns that value.

Otherwise it returns undef.

$con->set_config($key1 => $value1, $key2 => $value2 ...)

Set config parameters.

If some $key is unknown for this type of $con, it emits warning via BusyBird::Log.

AUTHOR

Toshio Ito, <toshioito at cpan.org>