Subject: | Cookbook section "Changing one field whenever another changes" incomplete |
I believe that this section should cover the use case where two fields are strongly related and their values should be kept in sync. In my case it is for instance a filename and a SHA1 checksum. I would like for the checksum to always be calculated from the file (something a DB default will obviously not be able to do), unless provided manually by the user for some obscure reason. Keeping this in mind, when using the example from "Changing one field whenever another changes", there are two use cases left unimplemented:
* creating a new Row with "path" set to non-undef
* calling ->update({ path => 'something' })
In both cases the custom mutator from the example is not called. I am not sure what to do about the second case -- is it enough to overload update() ? The first case can be easily handled by overloading new() as described just above in "Setting default values for a row".
I can provide a doc patch in a PR if you want, assuming you can confirm that overloading update(), new() and the accessor is enough to cover all bases.