X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class.git;a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FManual%2FCookbook.pod;h=87ffd968ea3fd96db5e2c30b386cecf76cec7cda;hp=3e3f5dbde2fa1fc620579566a54bae3bac72567b;hb=ddabf34f6bef467bc213d2263f5ab2eb4d463b24;hpb=a1e1a51f99ae4a98e8e0026ebe9ccb000330576b diff --git a/lib/DBIx/Class/Manual/Cookbook.pod b/lib/DBIx/Class/Manual/Cookbook.pod index 3e3f5db..87ffd96 100644 --- a/lib/DBIx/Class/Manual/Cookbook.pod +++ b/lib/DBIx/Class/Manual/Cookbook.pod @@ -1877,7 +1877,7 @@ just looking for this. For example, say that you have three columns, C, C, and C. You would like to make changes to C and have C be automagically set to the value of C squared. -You can accomplish this by overriding C: +You can accomplish this by overriding C in your L: sub store_column { my ( $self, $name, $value ) = @_; @@ -1890,6 +1890,10 @@ You can accomplish this by overriding C: Note that the hard work is done by the call to C, which redispatches your call to store_column in the superclass(es). +Generally, if this is a calculation your database can easily do, try +and avoid storing the calculated value, it is safer to calculate when +needed, than rely on the data being in sync. + =head2 Automatically creating related objects You might have a class C which has many Cs. Further, you