-
-
21 Apr 2004 15:22:25 UTC
- Distribution: Config-Frontend
- Module version: 0.18
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues
- Testers (660 / 0 / 1)
- Kwalitee
Bus factor: 0- 96.08% Coverage
- License: unknown
- Activity
24 month- Tools
- Download (6.81KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- unknown
- Reverse dependencies
- CPAN Testers List
- Dependency graph
- NAME
- SYNOPSIS
- ABSTRACT
- DESCRIPTION
- new(backend) --> Conf
- set(var,val) --> void
- get(var [, default]) --> string
- del(var) --> void
- move(fromvar,tovar) --> void
- exists(var) --> boolean
- set_prop(var,prop,val) --> void
- set_prop(var,prop,val) --> void
- get_prop(var,prop [,default]) --> string
- del_prop(var,prop) --> void
- move_prop(var,fromprop,toprop) --> void
- exists_prop(var,prop) --> boolean
- variables() --> list of stored variables
- properties(var) --> list of stored properties
- cache(cache_on) --> void
- clear_cache() --> void
- SEE ALSO
- AUTHOR
- COPYRIGHT AND LICENSE
NAME
Config::Frontend - Configuration module with flexible backends
SYNOPSIS
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;
ABSTRACT
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. AConfig::Frontend
object is instantiated with a backend.DESCRIPTION
new(backend) --> Conf
Should be called with a pre-instantiated backend. Returns a
Config::Frontend
object.set(var,val) --> void
Sets a variable with value val in the backend.
get(var [, default]) --> string
Returns the value for var as stored in the backend. Returns
undef
, if var does not exist in the backend anddefault
has not been given. Otherwise, returnsdefault
, if var does not exist in the backend.del(var) --> void
Deletes a variable from the backend. All properties for the variable are also removed.
move(fromvar,tovar) --> void
Rename a variable
fromvar
with all it's properties totovar
. Note. Iftovar
already exists, it will be overwritten.exists(var) --> boolean
Returns true, if
var
exists. Returns false, otherwise.set_prop(var,prop,val) --> void
Sets property
prop
for variablevar
to valueval
.set_prop(var,prop,val) --> void
Sets property
prop
for variablevar
to valueval
.get_prop(var,prop [,default]) --> string
Returns property
prop
for variablevar
, orundef
cq.default
if the property doesn't exist.del_prop(var,prop) --> void
Deletes property
prop
for variablevar
.move_prop(var,fromprop,toprop) --> void
Renames a property withing the bounds of a variable from
fromprop
totoprop
. Note. Iftoprop
already exists, it will be overwritten.exists_prop(var,prop) --> boolean
Returns true if property
prop
exists for variablevar
. False, otherwise.variables() --> list of stored variables
Returns a list all variables (not properties) stored in the backend.
properties(var) --> list of stored properties
Returns a list of all properties for a variable in the backend.
cache(cache_on) --> void
If
cache_on
= true, this will turn on caching for theget()
method. If caching is on, the get() method will only go to the backend if a variable does not exist in it's cache. Theset()
function will delete a variable from cache if it is updated. Thedel()
function will delete a variable from cache.clear_cache() --> void
Clears the cache.
SEE ALSO
Config::Backend::String, Config::Backend::SQL, Config::Backend::File, Config::Backend::INI.
AUTHOR
Hans Oesterholt-Dijkema, <oesterhol@cpan.org>
COPYRIGHT AND LICENSE
Copyright 2004 by Hans Oesterholt-Dijkema
This library is free software; you can redistribute it and/or modify it under Artistic License.
Module Install Instructions
To install Config::Frontend, copy and paste the appropriate command in to your terminal.
cpanm Config::Frontend
perl -MCPAN -e shell install Config::Frontend
For more information on module installation, please visit the detailed CPAN module installation guide.