NAME
Class::Inflate - Inflate HASH Object from Values in Database
SYNOPSIS
# in package
package Some::Package::Name;
use Class::Inflate (
$table_one => {
key => \@primary_key_fields,
methods => {
$method_one => $field_one,
$method_two => {
inflate => sub { join('-', @_) },
deflate => sub { split(/-/, shift(), 2) },
fields => [$field_two, $field_three],
},
},
},
$table_two => {
key => \@primary_key_fields,
join => {
$table_one => {
$field_one => $field_1,
},
},
methods => {
$method_$three => $field_2,
}
},
);
# in script
use Some::Package::Name;
my @objects = Some::Package::Name->inflate({$field_one => $value});
DESCRIPTION
Allows for any blessed HASH object to be populated from a database, by describing table relationships to each method.
EXPORT
Exports inflate
method into caller's namespace.
SEE ALSO
Tangram(3), Class::DBI(3), which have similar concepts, but are tied more closely to database structure.
AUTHOR
Nathan Gray, <kolibrie@cpan.org>
COPYRIGHT AND LICENSE
Copyright (C) 2005 by Nathan Gray
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.4 or, at your option, any later version of Perl 5 you may have available.