[Config-loader] [Config Loader] Adding / overriding config file
loaders was updated
Config Loader
noreply at google.com
Sat Aug 30 13:41:40 BST 2008
Clinton Gormley updated the page Adding / overriding config file loaders. =
View the changes below.
Color key: Insertion | Deletion
Loaders refer to the modules that are used for interpreting config files. =
The loader which is used would be determined by the file extension.
Adding new loaders
Here, we add a new loader to the existing list of loaders, and specify that=
=
it should be used for any files whose extensions don't match our known list=
=
( fallback ). In this case, extensions could be empty or not specified.
$c =3D Config::Loader->new({
add_loader =3D> {
module =3D> 'Config::Loader::YAML',
extensions =3D> ['yaml','yml','conf'],
fallback =3D> 1,
},
paths =3D> [
'/path/to/conf/tree/',
'/path/to/conf/file_1.yml',
],
});
Forcing a particular loader
Here, we add two loaders, specify options for the YAML loader, then for a =
particular file, we specify a particular loader with different options to =
the default.
$c =3D Config::Loader->new({
add_loaders =3D> [
{
module =3D> 'Config::Loader::YAML',
extensions =3D> ['yaml','yml','conf'],
options =3D> {
load_code =3D> 1,
}
},
{
module =3D> 'Config::Loader::XML',
extensions =3D> ['xml'],
fallback =3D> 1,
},
],
paths =3D> [
'/path/to/conf/tree/',
{
file =3D> '/path/to/conf/file_1.yml',
use_loader =3D> {
module =3D> 'Config::Loader::YAML',
options =3D> { load_code =3D> 0 }
},
}
],
});
Replacing the default loaders
Here we remove all of the default loaders, and replace them with just these=
=
two options.
$c =3D Config::Loader->new({
set_loaders =3D> [
{
module =3D> 'Config::Loader::YAML',
extensions =3D> ['yaml','yml','conf'],
options =3D> {
load_code =3D> 1,
}
},
{
module =3D> 'Config::Loader::XML',
extensions =3D> ['xml'],
fallback =3D> 1,
},
],
path =3D> '/path/to/conf/tree/'
});
Go to page: Adding / overriding config file loaders
-------------
You requested this notification from Google Sites. You can unsubscribe at =
any time.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/config-loader/attachments/20080830/=
3797a0d6/attachment.htm
More information about the Config-loader
mailing list