[Bast-commits] r4797 - DBIx-Class-DynamicDefault/1.000/trunk/lib/DBIx/Class

rafl at dev.catalyst.perl.org rafl at dev.catalyst.perl.org
Wed Sep 10 22:10:57 BST 2008


Author: rafl
Date: 2008-09-10 22:10:57 +0100 (Wed, 10 Sep 2008)
New Revision: 4797

Modified:
   DBIx-Class-DynamicDefault/1.000/trunk/lib/DBIx/Class/DynamicDefault.pm
Log:
Improve documentation.

Modified: DBIx-Class-DynamicDefault/1.000/trunk/lib/DBIx/Class/DynamicDefault.pm
===================================================================
--- DBIx-Class-DynamicDefault/1.000/trunk/lib/DBIx/Class/DynamicDefault.pm	2008-09-09 22:59:42 UTC (rev 4796)
+++ DBIx-Class-DynamicDefault/1.000/trunk/lib/DBIx/Class/DynamicDefault.pm	2008-09-10 21:10:57 UTC (rev 4797)
@@ -112,11 +112,39 @@
 
         my $accessor = $self->column_info($column_name)->{accessor} || $column_name;
         $self->$accessor($default_value);
+
+        $dirty{$column_name} = 1;
     }
 
-    return $self->next::method(@_);
+    return $self->next::method;
 }
 
+=head1 OPTIONS
+
+=head2 dynamic_default_on_create
+
+  dynamic_default_on_create => sub { ... }
+
+  dynamic_default_on_create => 'method_name'
+
+When inserting a new row all columns with the C<dynamic_default_on_create>
+option will be set to the return value of the specified callback unless the
+columns value has been explicitly set. The callback, that'll be invoked with
+the row object as its only argument, may be a code reference or a method name.
+
+=head2 dynamic_default_on_update
+
+  dynamic_default_on_update => sub { ... }
+
+  dynamic_default_on_update => 'method_name'
+
+When updating a row all columns with the C<dynamic_default_on_update> option
+will be set to the return value of the specified callback unless the columns
+value has been explicitly set.
+
+Columns will only be altered if other dirty columns exist. See C<always_update>
+on how to change this.
+
 =head1 AUTHOR
 
 Florian Ragwitz E<lt>rafl at debian.orgE<gt>




More information about the Bast-commits mailing list