Basset::Object::Persistent 1.03 review

Download
by rbytes.net on

Basset::Object::Persistent is a subclass of Basset::Object that allows objects to be easily stored into a relational database

License: Perl Artistic License
File size: 143K
Developer: Jim Thomason
0 stars award from rbytes.net

Basset::Object::Persistent is a subclass of Basset::Object that allows objects to be easily stored into a relational database. Presently only supports MySQL, but that may change in the future.

SYNOPSIS

(no synopsis, this is an abstract super class that should never be instantiated directly, it should be subclassed for all persistent objects and used through them)

Basset::Object is the uber module in my Perl world. All objects should decend from Basset::Object. It handles defining attributes, error handling, construction, destruction, and generic initialization. It also talks to Basset::Object::Conf to allow conf file use.
But, some objects cannot simply be recreated constantly every time a script runs. Sometimes you need to store the data in an object between uses so that you can recreate an object in the same form the last time you left it. Storing user information, for instance.

Basset::Object::Persistent allows you to do that transparently and easily. Persistent objects need to define several pieces of additional information to allow them to commit to the database, including their table definitions. Once these items are defined, you'll have access to the load and commit methods to allow you to load and store the objects in a database.

It is assumed that an object is stored in the database in a primary table. The primary table contains a set of columns named the same as object attributes. The attributes are stored in those columns.

Some::Package->add_attr('foo');
my $obj = Some::Package->new();
$obj->foo('bar');
$obj->commit();

in the database, the 'foo' column will be set to 'bar'.

Requirements:
Perl

Basset::Object::Persistent 1.03 search tags