Coat-Persistent

 view release on metacpan or  search on metacpan

lib/Coat/Persistent.pm  view on Meta::CPAN


=pod

=head1 NAME

Coat::Persistent -- Simple Object-Relational mapping for Coat objects

=head1 DESCRIPTION

Coat::Persistent is an object to relational-databases mapper, it allows you to
build instances of Coat objects and save them into a database transparently.

You basically define a mapping rule, either global or per-class and play with
your Coat objects without bothering with SQL for simple cases (selecting,
inserting, updating). 

Coat::Peristent lets you use SQL if you want to, considering SQL is the best
language when dealing with compelx queries.

=head1 WHY THIS MODULE ?

lib/Coat/Persistent.pm  view on Meta::CPAN

Coat::Persistent classes have the keyword B<has_p> to define persistent
attributes. Attributes declared with B<has_p> are valid Coat attributes and
take the same options as Coat's B<has> method. (Refer to L<Coat> for details).

All attributes declared with B<has_p> must exist in the mapped data backend
(they are a column of the table mapped to the class).

=item B<has_one $class>

Tells that current class owns a subobject of the class $class. This will allow
you to set and get a subobject transparently.

The backend must have a foreign key to the table of $class.

Example:

    package Foo;
    use Coat::Persistent;

    has_one 'Bar';

lib/Coat/Persistent/Types/MySQL.pm  view on Meta::CPAN

__END__

=pod

=head1 NAME

Coat::Persistent::Types::MySQL -- Attribute types and coercions for MySQL data types

=head1 DESCRIPTION

The types defined in this module are here to provide simple and transparent
storage of MySQL data types. This is done for atttributes you want to store 
with a different value than the one the object has.

For instance, if you have a datetime field, you may want to store it as a MySQL
"datetime" format (YYYY-MM-DD HH:MM:SS) and handle it in your code as a
timestamp, which is much more convinient for updates.

This is possible by using the types defined in this module.

=head1 EXAMPLE 



( run in 0.324 second using v1.01-cache-2.11-cpan-0a6323c29d9 )