Config::Backend::SQL - An SQL backend for Config::Frontend.
Config::Backend::SQL is an SQL backend for Config::Frontend. It handles a table $table with identifiers that are assigned values. The identifiers are specified on a per user basis. Config::Backend::SQL tries to get the user account of the user self.
Config::Backend::SQL
$table
Each call set() will immediately result in a commit to the database.
set()
new(DSN => ...,DBUSER => ..., DBPASS =>, [TABLE => ...]) --> Config::Backend::SQL
Invoked with a valid DSN, DBUSER and DBPASS combination, will return a Config::Backend::SQL object that is connected to the database.
DSN
DBUSER
DBPASS
TABLE defaults to conf_table.
conf_table
This function will try to create a TABLE table in the given DSN, if it does not exist. This will probably succeed for DBD drivers Pg, mysql and sqlite.
TABLE
If this module cannot create a table for you, because it doesn't know the database you are using, you can create your own (or send modifications to the author). The table used has following form:
CREATE TABLE $table(uid varchar,var varchar,value varchar)
The form presented here is a PostgreSQL form. You will want at least following specifications for uid, var and value:
PostgreSQL
uid varchar(1024) var varchar(250) value text, bigtext, mediumtext, varchar(1000000000), etc.
You may also want an index on $table, like this one:
"CREATE INDEX $table"."_idx ON $table(uid, var)"
This function will disconnect from the database.
set(var,value) --> void
Sets config key var to value.
get(var) --> string
Reads var from config. Returns undef, if var does not exist. Returns the value of configuration item var, otherwise.
undef
var
del(var) --> void
Delets var from the table.
variables() --> list of strings
Returns all variables in the configuraton backend.
Config::Frontend.
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 LGPL.
To install Config::Backend::SQL, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Config::Backend::SQL
CPAN shell
perl -MCPAN -e shell install Config::Backend::SQL
For more information on module installation, please visit the detailed CPAN module installation guide.