in reply to Overriding method in multiple DBIx::Class child classes
This should be what you want. A couple of stubs and fake names shown to give you ideas for how to fill in the blanks. :P The new helper component–
package MyDB::Audit; use parent qw( DBIx::Class ); use strict; use warnings; sub update { my $self = shift; return $self->next::method(@_) if some_reason_not_to_log_this_one($self->table); my %data = $self->get_dirty_columns; _log_changed_data(\%data); $self->next::method(@_); } 1;
One of your current result source classes–
package MyDB::Result::Dingus; use strict; use warnings; use parent "DBIx::Class::Core"; __PACKAGE__->load_components("+MyDB::Audit"); __PACKAGE__->table("Dingus"); __PACKAGE__->add_columns( ...et cetera... );
Have fun. :P
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Overriding method in multiple DBIx::Class child classes
by MattLG (Beadle) on Sep 19, 2016 at 09:45 UTC | |
by Your Mother (Archbishop) on Sep 19, 2016 at 12:59 UTC |