Coat::Persistent::Types
This module provides a set of types and coercions that are of common use when dealing with an database.
By loading this module you are able to use all the types defined here for your attribute definitions (either for the 'isa' option or fore the 'store_as' one).
UnixTimestamp
An Int that is strictly greater than 0 and that represent the time since 1970-01-01 00:00:01
Date
A string representing the date with the following format: YYYY-MM-DD
DateTime
All the types defined are coerceable from the type UnixTimestamp and the type UnixTimestamp can be coerced to all the types defined.
package Stuff; use Coat::Persistent::Types; # we have a date field, we want to store it and to handle it as string # formated like YYYY-MM-DD has_p birth_date => ( is => 'ro', isa => 'Date', ); # we have a datetime that's changed whenever the object si touched. # we want to handle the data as a timestamp, and to store it as DateTime string. has_p last_update => ( is => 'rw', isa => 'UnixTimestamp', store_as => 'DateTime', ); # or if you'd rather have a Class::Date object than a UnixTimestamp : has_p last_update => ( is => 'rw', isa => 'Class::Date', store_as => 'DateTime', );
Class::Date
All the types defined in this module are coerceable from or to the type UnixTimestamp.
Coat::Types Coat::Persistent::Types::
Alexis Sukrieh <sukria@cpan.org> http://www.sukria.net
1 POD Error
The following errors were encountered while parsing the POD:
'=item' outside of any '=over'
To install Coat::Persistent, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Coat::Persistent
CPAN shell
perl -MCPAN -e shell install Coat::Persistent
For more information on module installation, please visit the detailed CPAN module installation guide.