Andrew Sterling Hanenkamp > DustyDB-0.06 > DustyDB::Meta::Attribute

Download:
DustyDB-0.06.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 0.06   Source  

NAME ^

DustyDB::Meta::Attribute - Moose meta-class for DustyDB::Record attributes

VERSION ^

version 0.06

DESCRIPTION ^

For any model class (one that uses DustyDB::Object and does DustyDB::Record), all the attributes will be given this Moose meta-class role. These attributes are used to help with encoding and decoding types that might not be easily stored directly within DBM::Deep.

ATTRIBUTES ^

encode

This is a subroutine used to transform a Perl object into a something else you want to store. Since we use DBM::Deep to store the objects, this can be much more flexible than just a scalar.

Be careful, though, not to store a hash with a class_name key or very bad things might happen.

This subroutine should expect the decoded value in $_ and return whatever value should be stored.

decode

This is a subroutine used to transform the previously encoded and stored "thing" into the object that is stored in the column.

This subroutine should expect the encoded value in $_ and return whatever value should be loaded into the model attribute.

METHODS ^

perform_encode

This is a helper method to make sure that encoding is performed properly.

perform_decode

This is a helper method to make sure that decoding is performed properly.

syntax highlighting: