Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Overriding method in multiple DBIx::Class child classesby MattLG (Sexton) |
on Sep 16, 2016 at 08:26 UTC ( [id://1171920]=perlquestion: print w/replies, xml ) | Need Help?? |
MattLG has asked for the wisdom of the Perl Monks concerning the following question: I have a series of DBIx::Class classes that have been auto-generated by the Schema Loader. I also want to maintain an audit trail of changes to any database table entries, so I've started overriding the update() method on each. But after the first couple, I've realised that the overrides will actually be completely identical. I'd obviously rather not duplicate 35 lines of identical code in all 20 classes if I can get away with it. What is the best way to achieve this?
The first option that I considered was multiple inheritance, but the overriding method needs to call its parent method in the DBIx::Class::Core:
Back to
Seekers of Perl Wisdom
|
|