[Catalyst] Overloading delete and update CRUD methods - but where?
andyh.enable at gmail.com
Fri Aug 8 08:16:42 GMT 2014
I'm working on a Catalyst application which mainly uses
Catalyst::Controller::DBIC:API::REST to provide CRUD (Create, Read, Update,
Delete) access to a MySQL database.
A feature the customer requires is that database records are
non-destructive, in order to provide an additional level of security (the
application is financial, so it's important that users cannot remove
records from the actual database). The number of records which will be in
the final system is relatively low, in the thousands, so the presence of
defunct records will not slow down database operations).
To implement this I have added a flag, "defunct" to all database tables,
and I now need to overload the delete and update methods as follows:
delete -> set defunct to true
update -> delete (see above) existing record, write updated record to the
What I can't work out at the moment is where in the inheritance hierarchy
of classes are the methods I should overload. It doesn't look as though
Catalyst::DBIC::API is the correct place, since there seem to be a number
of similar but related methods to perform deletion and updating. The
individual record methods as far as I can see are implemented at the bottom
level of Moose, but I'm not sufficiently comfortable with Moose internals
to work out exactly what to overload. I'm continuing with research on the
matter, but thsi must be a behaviour which has been done before, and any
advice or pointers to online documentation or tutorials would be very handy.
Thanks in advance for any help, I will summarize results to the list if
Andy Holyer, Brighton, UK.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Catalyst