[Dbix-class] Breakage on .127 -> .192 upgrade

Toby Corkindale toby at dryft.net
Fri May 20 01:52:18 GMT 2011


Hi,
I don't know how I failed to pick this up during the testing period
for the .19x versions.

I have some code that fails on dbic .192, but works when rolled back to .127.
The failure is due to the Result class defining some accessors with
mk_classdata() which are referred to from within a sqlt_deploy_hook()
method.

Under .127, the accessors were found.
Under .192, an error is thrown during deployment:
DBIx::Class::Schema::deploy(): Unable to produce deployment
statements: translate: Error with parser
'SQL::Translator::Parser::DBIx::Class': Can't locate object method
"my_accessor" via package "DBIx::Class::ResultSource::Table"

I'm guessing the inheritance pattern has changed a bit?

I note that under .127, the following code says that ref($self) == ""
What's with that?
Under .192, ref($self) == "DBIx::Class::ResultSource::Table"

sub sqlt_deploy_hook {
    my ( $self, $sqlt_table ) = ( @_ );
    warn "sqlt_deploy_hook self isa: " . ref($self);
    ...
    $self->my_accessor(...);
}


I didn't write this code pattern originally..

What is the correct way to store/access object methods during
deployment such that it's compatible?

At the moment I've gone for:

sub sqlt_deploy_hook {
    my ( $self, $sqlt_table ) = ( @_ );
    $self->result_class->my_accessor(...);
}


Cheers,
Toby



More information about the DBIx-Class mailing list