Maplat::Web::UserSettings - save and load user/module specific data
This module provides handling module-specific data handling on a per user basis
This module provides a simple interface to the PostgreSQL database for saving and loading module specific data on a per user basis. It can, for example, be used to save user specific filters to the database. It can handle complex data structures.
In the background, it uses Storable and Base64 to store complex data structures and text in a database text field. This avoids having to play around with blobs.
<module> <modname>usersettings</modname> <pm>UserSettings</pm> <options> <db>maindb</db> <memcache>memcache</memcache> </options> </module>
This module implements its own memcached-based caching strategy. Use Maplat::Web::MemCache as the memcache module, don't use Maplat::Web::MemCachePg. While both will work and data will be stored permanently, using MemCachePg will generate some overhead, because the data will be saved redundatly in two places.
This function adds or updates a setting (data structure) in the database.
It takes three arguments, $username is the username, $settingname is the key name of the setting, and $settingref is a reference to the data structure you want to store, e.g.:
$is_ok = $us->set($username, $settingname, $settingref);
It returns a boolean to indicate success or failure.
This function reads a setting from database and returns a reference to the data structure.
It takes two arguments, $username is the username and $settingname is the key name of the setting.
$settingref = $us->get($username, $settingname);
This function deletes a setting from database and returns a boolean to indicate success or failure.
$is_ok = $us->delete($username, $settingname);
This function lists all available settings for a username.
It takes one arguments, $username is the username.
@settingnames = $us->list($username);
This module is a basic web module and does not depend on other web modules.
Maplat::Web
Rene Schickbauer, <rene.schickbauer@gmail.com>
Copyright (C) 2008-2011 by Rene Schickbauer
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.0 or, at your option, any later version of Perl 5 you may have available.
To install Maplat, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Maplat
CPAN shell
perl -MCPAN -e shell install Maplat
For more information on module installation, please visit the detailed CPAN module installation guide.