[Bast-commits] r4545 -
DBIx-Class-DynamicDefault/1.000/trunk/lib/DBIx/Class
rafl at dev.catalyst.perl.org
rafl at dev.catalyst.perl.org
Tue Jul 1 13:20:52 BST 2008
Author: rafl
Date: 2008-07-01 13:20:52 +0100 (Tue, 01 Jul 2008)
New Revision: 4545
Modified:
DBIx-Class-DynamicDefault/1.000/trunk/lib/DBIx/Class/DynamicDefault.pm
Log:
Another SYNOPSIS example.
Modified: DBIx-Class-DynamicDefault/1.000/trunk/lib/DBIx/Class/DynamicDefault.pm
===================================================================
--- DBIx-Class-DynamicDefault/1.000/trunk/lib/DBIx/Class/DynamicDefault.pm 2008-06-30 20:07:13 UTC (rev 4544)
+++ DBIx-Class-DynamicDefault/1.000/trunk/lib/DBIx/Class/DynamicDefault.pm 2008-07-01 12:20:52 UTC (rev 4545)
@@ -27,7 +27,10 @@
quux => { data_type => 'integer' },
quux_plus_one => { data_type => 'integer',
dynamic_default_on_create => \&quux_plus_one_default,
- dynamic_default_on_update => 'quux_plus_one_default', }
+ dynamic_default_on_update => 'quux_plus_one_default', },
+ last_changed => { data_type => 'integer',
+ dynamic_default_on_create => 'now',
+ dynamic_default_on_update => 'now, },
);
sub quux_plus_one_default {
@@ -35,6 +38,10 @@
return $self->quux + 1;
}
+ sub now {
+ return DateTime->now->epoch;
+ }
+
Now, any update or create actions will set the specified columns to the value
returned by the callback you specified as a method name or code reference.
More information about the Bast-commits
mailing list