[Dbix-class] Audit Trails/History Component

Tobias Kremer t at funkreich.de
Thu Aug 31 13:23:44 CEST 2006


I'm trying to implement an audit trail functionality as a DBIx::Class component.
Every modification (insert, update, delete) of a model that has loaded
this component should be logged in a dedicated table to provide some sort of
history of what happened to the data in the model.

Basically I'm overriding the insert, update and delete methods in my component.
Unfortunately PK::Auto's insert method first calls the other components in the
chain (as far as i understand this whole overriding-next-c3-fu) and then
retrieves a new primary key if none is already given. This leads to the
problem that my component needs a primary key to make a reference in the
audit trail/history table to the modified record but it's not there because
PK::Auto delays the fetching of a new primary key value until all other
components
were run(?)

Any ideas on how to solve this?

Thanks a lot!

-- 
Tobias Kremer
Web Architect



More information about the Dbix-class mailing list