Krang::Conf - Krang configuration module
# all configuration directives are available as exported subs use Krang::ClassLoader Conf => qw(KrangRoot Things); $root = KrangRoot; @things = Things;
# you can also call get() in Krang::Conf directly
$root = pkg('Conf')->get("KrangRoot");
# or you can access them as methods in the Krang::Conf module
$root = pkg('Conf')->rootdir;
# the current instance, which affects the values returned, can
# manipulated with instance():
pkg('Conf')->instance("this_instance");
# get a list of available instances
@instances = pkg('Conf')->instances();
This module provides access to the configuration settings in
krang.conf. The routines provided will return the correct settings
based on the currently active instance, accesible and setable using
Krang::Conf->instance().
Full details on all configuration parameters is available in the configuration document, which you can find at:
http://krang.sourceforge.net/docs/configuration.html
$value = Krang::Conf->get("DirectiveName")
@values = Krang::Conf->get("DirectiveName")
Returns the value of a configuration directive. Directive names are case-insensitive.
$value = Krang::Conf->directivenamehere()
@values = Krang::Conf->directivenamehere()
Gets the value of a directive using an autoloaded method. Case-insensitive.
$value = ExportedDirectiveName()
@values = ExportedDirectiveName()
Gets the value of a variable using an exported, autoloaded method. Case-insensitive.
$current_instance = Krang::Conf->instance()
Krang::Conf->instance("instance name")
Gets or sets the currently active instance. After setting the active instance, all requests for variables will retrieve values specific to this instance.
Before the first call to instance() only globally declared variables
are available. Setting the instance to undef will recreate this
state.
@instances = Krang::Conf->instances()
Returns a list of available instances.
Krang::Conf->check()
Sanity-check Krang configuration. This will die() with an error
message if something is wrong with the configuration file.
This is run when the Krang::Conf loads unless the environment variable ``KRANK_CONF_NOCHECK'' is set to a true value.