Ambrosia::Config - a class for read a configuration data. It implements the pattern Singleton.
version 0.010
#In the file "test.pl" use Ambrosia::Config; use Foo; BEGIN { instance Ambrosia::Config( myApplication => './foo.conf' ); }; Ambrosia::Config::assign 'myApplication'; #.............. say Foo::proc1(); #.............. #In the file "Foo.pm" package Foo; use Ambrosia::Config; sub proc1 { return config->ParamA; } 1; #In the config file "foo.conf" return { ParamA => 'ABC' };
Ambrosia::Config is a class of object Ambrosia::Config. The file of config is the perl script that MUST return reference to hash. Each key of the hash becomes a method of object of type Ambrosia::Config that return an appropriate value.
Ambrosia::Config
WARNING! This method is "lvalue" and you can modify a config value on the fly.
This method instantiates the named object of type Ambrosia::Config in the pool. This method not exported. Use as constructor: instance Ambrosia::Config(.....) instance(name => path) - where the "name" is a keyname for config and the "path" is a path to config file. instance(name => hash) - where the "name" is a keyname for config and the "hash" is a config data.
instance Ambrosia::Config(.....)
instance(name => path)
instance(name => hash)
Returns the global object of type Ambrosia::Config. config(name) - the "name" is optional param. Call with "name" if you not assign current process to config.
config(name)
Assign current process to the global named object of type Ambrosia::Config.
Ambrosia::core::Exceptions Ambrosia::Meta
Not tested.
Please report bugs relevant to Ambrosia to <knm[at]cpan.org>.
Ambrosia
Copyright (C) 2010-2012 Nickolay Kuritsyn. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Nikolay Kuritsyn (knm[at]cpan.org)
To install Ambrosia, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Ambrosia
CPAN shell
perl -MCPAN -e shell install Ambrosia
For more information on module installation, please visit the detailed CPAN module installation guide.