Ulrich Kautz > Mail-Decency > Mail::Decency::Helper::Database

Download:
Mail-Decency-0.1.6.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

Mail::Decency::Helper::Database

DESCRIPTION ^

Base class for all databases

SYNPOSIS ^

Create a new datbaase like this:

    Mail::Decency::Helper::Database->create( MongoDB => $config_ref );

CLASS ATTRIBUTES ^

type : Str

The type of the database (DBD, MongoDB)

logger : CodeRef

Log-Handler method

locker : IPC::Semaphore

locker_pid : Int

PID of process creating the semaphore

METHODS ^

create $type, $args_ref

Returns a new instance of the create database object

    my $database = Mail::Decency::Helper::Database->create( DBD => $args_ref );

DEMOLISH

Remove locker

get $schema, $table, $search_ref

Searches and returns single entry from database

See parse_data method for return contexts.

set $schema, $table, $search_ref, $data_ref

Writes to database. Could affect multiple entries.

search $schema, $table, $search_ref

Returns a list of search results (in opposite to the get method). In scalar contexts it returns an ArrayRef instead

update_data

Transforms flat (scalar) values into { data => $value } hashrefs

parse_data $data_ref

Transforms hashref values in an array context from { value => $value } to ( $value )

In array-context, it will return the content of the "data" field, if any

Can be modified in derived modules.

update_query $query_ref

Update method for search query. Can be overwritten/extended in derived modules.

do_lock

Locks via flock file

do_unlock

Unlocks the flock

read_lock

Do read lock

read_unlock

Do unlock read

write_lock

Do read lock

write_unlock

Do unlock read

usr_lock

Custom locker

usr_lock

Custom locker

AUTHOR ^

Ulrich Kautz <uk@fortrabbit.de>

COPYRIGHT ^

Copyright (c) 2010 the "AUTHOR" as listed above

LICENCSE ^

This library is free software and may be distributed under the same terms as perl itself.

syntax highlighting: