[Dbix-class] Overriding create(), txn_do,
and 'No next::method' from Class::C3
Pedro Melo
melo at simplicidade.org
Tue Jul 10 20:55:42 GMT 2007
Hi,
I'm trying to override create() on a ResultSet subclass. Inside I
defined a create() method.
The simplest create I could find that triggers the error is this:
package S::BaseResultSet;
use strict;
use base qw( DBIx::Class::ResultSet );
use Class::C3;
sub create {
my $self = shift;
$self->result_source->schema->txn_do( sub {
# do something here about logging
$new_record = $self->next::method($values);
});
return $new_record;
}
The problem is that the next::method inside the closure will search
for the next method of the txn_do and not of the create call().
Any tips on how to go about this? For now, I replaced the txn_do with
txn_begin/commit/rollback, but my quick hack is not as good as the
txn_do inside DBIC::Storage::DBI...
Thanks in advance,
--
Pedro Melo
Blog: http://www.simplicidade.org/notes/
XMPP ID: melo at simplicidade.org
Use XMPP!
More information about the Dbix-class
mailing list