|
NAMEClass::Inflate - Inflate HASH Object from Values in DatabaseSYNOPSIS# 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}); DESCRIPTIONAllows for any blessed HASH object to be populated from a database, by describing table relationships to each method.When specifying a database relationship to a method, there are several hooks you can specify:
The database fields are specified as an ARRAY reference of field names, if any of the hooks are used. EXPORTExports "inflate" method into caller's namespace.SEE ALSOTangram(3), Class::DBI(3), which have similar concepts, but are tied more closely to database structure.AUTHORNathan Gray, <kolibrie@cpan.org>COPYRIGHT AND LICENSECopyright (C) 2006, 2008 by Nathan GrayThis 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.
Visit the GSP FreeBSD Man Page Interface. |