ObjectDB - Lightweight Object-relational mapper
ObjectDB is a lightweight, deps free (except DBI of course) and flexible object-relational mapper.
It combines all the best features from Class::DBI, DBIx::Class and Rose::DB but stays as light as possible.
ObjectDB abstract is not that heavy as in Rose::DB: columns are not objects, everything is pretty much straight forward and flat.
Embedded SQL generator is similar to SQL::Abstract, but leaves low-level sql generation still possible.
Returns true when object was created or loaded. Otherwise false.
Returns true when object was modified (setting columns). Otherwise false.
Returns a new ObjectDB object.
Sets objects columns.
Used to define class schema. For more information see ObjectDB::Schema.
Returns object columns that are set or have a default value.
Gets and sets column value.
Object cloning. Everything is copied except primary key and unique key values.
Roll back transaction.
Creates a new object. Sets auto increment field to the last inserted id.
Loads object using primary key or unique key that was provided when creating a new instance. Dies if there was no primary or unique key.
Find objects. The second argument is a hashref that is translated into sql. Keys that can be used:
Build SQL. For more information see ObjectDB::SQL.
Prefetch related objects.
By default find returns array reference, by setting single to 1 undef or one object is returned (the first one).
With page_size you can select specific pages without calculation limit and offset by yourself.
The size of the page. It is 20 items by default.
Select only specific columns.
my $author = $article->related('author');
Gets prefetched related object(s).
Creates related objects.
Finds related objects.
Same as find_objects but sets related method.
Counts related objects.
Updates related objects. Use set key for setting new values.
Deletes related objects.
Creates and deletes related objects to satisfy the set. Usefull when setting many to many relationships.
Serializes object to hash. All prefetched objects are serialized also.
Viacheslav Tykhanovskyi, email@example.com.
In alphabetical order:
Copyright (C) 2009, Viacheslav Tykhanovskyi.
This program is free software, you can redistribute it and/or modify it under the same terms as Perl 5.10.
To install ObjectDB, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.