The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

User::Config::DB::Keyed - Store User-Configuration in a large Key-Value-Table.

SYNOPSIS

  use User::Config;

  my $uc = User::Config->instance;
  $uc->db("Keyed",  { table => "user", db => "dbi:SQLite:user.sqlite" });

DESCRIPTION

This is a database-backend for User::Config. The options will be stored within a table consisting of - at least - three columns:

user - will save the current users name (default: "uid")
item - will save the namespace and the name of the option (default: "item")
value - will store the value (default: "value")

The names of these columns as well of the tables are configurable. Further columns wont be touched.

ATTRIBUTES

All attributes are read-only and should be given at the time of initialization.

table

This attribute must be given and contain the name of the table within the database to use.

db

This attribute must be given, too. It consits of a DBI-string to connect to the database.

db_user and db_pwd

These attributes contain optional username and password for the database-connection

user_column, item_column and value_column

this will contain the names of the columns used to store the user, item and value. The default values are shown above.

METHODS

$db-set($package, $user, $option_name, $context, $value)>

assigns the value for the given user to the option within a package. See User::Config::DB

$db-isset($package, $user, $option_name, $context)>

Checks wether the option was set. See User::Config::DB

$db-get($package, $user, $option_name, $context)>

retrieves the currently set value. See User::Config::DB

SEE ALSO

User::Config User::Config::DB DBI

AUTHOR

Benjamin Tietz <benjamin@micronet24.de>

COPYRIGHT AND LICENSE

Copyright (C) 2011 by Benjamin Tietz

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.1 or, at your option, any later version of Perl 5 you may have available.