in reply to Add a method to a ResultSet Class in DBIx::Class?
I have only done marginal work with DBIx::Class, but I think simply declaring the methods in the appropriate ResultSet subclass should work:
package ThreadedDB::Article::ResultSet; #use base 'DBIx::Class::ResultSet'; sub insert_article { my ($self, $topic, $parent, $msgtext) = @_; my $articles = $self->resultset('Article'); eval { $self->txn_do (sub { # a complex operation that is not relevant yet }) }; }
I left out the use base statement, because DBIx::Class will hopefully set up @ISA correctly when it's creating the subclasses.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Add a method to a ResultSet Class in DBIx::Class?
by jasonk (Parson) on Jan 09, 2008 at 18:25 UTC | |
Re^2: Add a method to a ResultSet Class in DBIx::Class?
by matija (Priest) on Jan 09, 2008 at 12:25 UTC | |
by Corion (Patriarch) on Jan 09, 2008 at 12:29 UTC | |
by matija (Priest) on Jan 09, 2008 at 12:41 UTC | |
by Corion (Patriarch) on Jan 09, 2008 at 14:12 UTC |