DustyDB

 view release on metacpan or  search on metacpan

lib/DustyDB/Meta/Attribute.pm  view on Meta::CPAN

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
For any model class (one that uses L<DustyDB::Object> and does L<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 direct...
 
=head1 ATTRIBUTES
 
=head2 encode
 
This is a subroutine used to transform a Perl object into a something else you want to store. Since we use L<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 C<class_name> key or very bad things might happen.
 
This subroutine should expect the decoded value in C<$_> and return whatever value should be stored.
 
=cut
 
has encode => (
    is => 'rw',
    isa => 'CodeRef',
    required => 1,
    default => sub { sub { $_ } },
);



( run in 0.245 second using v1.01-cache-2.11-cpan-ec4f86ec37b )