[Dbix-class] load_namespaces with extra resultset base class, without defining each one?

Mark Hedges hedges at formdata.biz
Mon Nov 1 02:42:14 GMT 2010


Is there a way to call My::Schema->load_namespaces() to add
a base class to every ResultSet, without having to spell out
each ResultSet package just to do 'use base'?

I overloaded delete(), insert() and update() in my Row base
class to also insert an audit log entry for a handful of
tables that need it.

However, delete() in ResultSet does not call the Row
methods, and it is pretty complicated for subclassing to
figure out audit entries... basically my subclass would
have to replicate all the logic in ResultSet::delete() to
figure out what to audit.

So, what I want to do is throw an exception from
ResultSet::delete() if $self->result_source->table is one of
the small number of audited tables.

Is there a way to add a base class to every ResultSet in the
first place?  If not, it would be nice.

Thanks for the info.

Mark




More information about the DBIx-Class mailing list