
Config::Frontend - Configuration module with flexible backends

use Config::Frontend;
use Config::Frontend::String;
open my $in,"<conf.cfg";
my $string=<$in>;
close $in;
my $cfg=new Conf(new Config::Frontend::String(\$string))
print $cfg->get("config item 1");
$cfg->set("config item 1","Hi There!");
$cfg->set("cfg2","config 2");
$cfg->del("config item 1");
open my $out,">conf.cfg";
print $out $string;
close $out;

This module can be used to put configuration items in. It's build up by using a backend and an interface. The interface is through the Config::Frontend module. A Config::Frontend object is instantiated with a backend.

new(backend) --> ConfShould be called with a pre-instantiated backend. Returns a Config::Frontend object.
set(var,val) --> voidSets a variable with value val in the backend.
get(var [, default]) --> stringReturns the value for var as stored in the backend. Returns undef, if var does not exist in the backend and default has not been given. Otherwise, returns default, if var does not exist in the backend.
del(var) --> voidDeletes a variable from the backend. All properties for the variable are also removed.
move(fromvar,tovar) --> voidRename a variable fromvar with all it's properties to tovar. Note. If tovar already exists, it will be overwritten.
exists(var) --> booleanReturns true, if var exists. Returns false, otherwise.
set_prop(var,prop,val) --> voidSets property prop for variable var to value val.
set_prop(var,prop,val) --> voidSets property prop for variable var to value val.
get_prop(var,prop [,default]) --> stringReturns property prop for variable var, or undef cq. default if the property doesn't exist.
del_prop(var,prop) --> voidDeletes property prop for variable var.
move_prop(var,fromprop,toprop) --> voidRenames a property withing the bounds of a variable from fromprop to toprop. Note. If toprop already exists, it will be overwritten.
exists_prop(var,prop) --> booleanReturns true if property prop exists for variable var. False, otherwise.
variables() --> list of stored variablesReturns a list all variables (not properties) stored in the backend.
properties(var) --> list of stored propertiesReturns a list of all properties for a variable in the backend.
cache(cache_on) --> voidIf cache_on = true, this will turn on caching for the get() method. If caching is on, the get() method will only go to the backend if a variable does not exist in it's cache. The set() function will delete a variable from cache if it is updated. The del() function will delete a variable from cache.
clear_cache() --> voidClears the cache.

Config::Backend::String, Config::Backend::SQL, Config::Backend::File, Config::Backend::INI.

Hans Oesterholt-Dijkema, <oesterhol@cpan.org>

Copyright 2004 by Hans Oesterholt-Dijkema
This library is free software; you can redistribute it and/or modify it under Artistic License.