use strict;\r
use warnings;\r
\r
+our $VERSION = '0.01';\r
+\r
use base qw( DBIx::Class );\r
\r
use DateTime;\r
\r
+=head1 NAME\r
+\r
+DBIx::Class::DateTime::Epoch - Automatic inflation/deflation of epoch-based DateTime objects for DBIx::Class\r
+\r
+=head1 SYNOPSIS\r
+\r
+ package foo;\r
+ \r
+ use base qw( DBIx::Class );\r
+ \r
+ __PACKAGE__->load_components( qw( DateTime::Epoch Core ) );\r
+ __PACKAGE__->add_columns(\r
+ name => {\r
+ data_type => 'varchar',\r
+ size => 10\r
+ },\r
+ bar => {\r
+ data_type => 'bigint',\r
+ datetime => 'datetime'\r
+ },\r
+ creation_time => {\r
+ data_type => 'bigint',\r
+ datetime => 'ctime'\r
+ },\r
+ modification_time => {\r
+ data_type => 'bigint',\r
+ datetime => 'mtime'\r
+ }\r
+ );\r
+\r
+=head1 DESCRIPTION\r
+\r
+This module automatically inflates/deflates DateTime objects\r
+corresponding to applicable columns. Columns may also be\r
+defined to specify their nature, such as columns representing a\r
+creation time (set at time of insertion) or a modification time\r
+(set at time of every update).\r
+\r
+=head2 register_column\r
+\r
+This method will automatically add inflation and deflation rules\r
+to a column if a datetime value has been set in the column's definition.\r
+If the datetime value is 'ctime' (creation time) or 'mtime'\r
+(modification time), it will be registered as such for later\r
+use by the insert and the update methods.\r
+\r
+=head2 insert\r
+\r
+This method will set the value of all registered creation time\r
+columns to the current time. No changes will be made to a column\r
+whose value has already been set.\r
+\r
+=head2 update\r
+\r
+This method will set the value of all registered modification time\r
+columns to the current time. This will overwrite a column's value,\r
+even if it has been already set.\r
+\r
+=head1 SEE ALSO\r
+\r
+=over 4\r
+\r
+=item * DateTime\r
+\r
+=item * DBIx::Class\r
+\r
+=back\r
+\r
+=head1 AUTHOR\r
+\r
+=item * Brian Cassidy E<lt>bricas@cpan.orgE<gt>\r
+\r
+=back\r
+\r
+=head1 COPYRIGHT AND LICENSE\r
+\r
+Copyright 2006 by Brian Cassidy\r
+\r
+This library is free software; you can redistribute it and/or modify\r
+it under the same terms as Perl itself. \r
+\r
+=cut\r
+\r
__PACKAGE__->mk_classdata( ctime_columns => [ ] );\r
__PACKAGE__->mk_classdata( mtime_columns => [ ] );\r
\r