NAME

Karma::DB -- the Karma System generic textual database.


SYNOPSIS

use Karma::DB

my %users = tie 'Karma::DB', Directory => 'users/';

$users{'joe'}{'birthdate'} = 'none, he\'s dead!';

In this example the line 'birthdate => none, he's dead!' is inserted into a file named joe in directory users/.


DESCRIPTION

This module is used by the Karma System to store the user specific data. The reason for using this implementation as opposed to one of the other modules of this type is clear:

consistency!

Other simple databases of this type do not ensure that the copy of data in memory is synchronized with the copy on disk. This module does, and in doing so further prevents corruption of said data.

File locking is also implemented, so this is overall a very safe storage container. There is a small performance cost involved in checking the files modification time on each access to a key, but it doesn't present a problem since, in practice, this data is accessed infrequently.

Multi-line scalars are supported, but no other data types will be stored. That means arrays and hashes must be flattened before they can be stored. eg.

$users{'joe'}{'groups'} = join(':', keys( %groups ));