I am using CGI :: Application on mod_perl with DBIx :: Class, and I would like something like new to define a new dbic schema when instantiating. So far, I have not been able to get it to work. The closest I came to is a superclass that has a connect () method that returns a new object, but I would prefer it to be already connected and created.
I would really appreciate any thoughts.
Thanks!
Note : Okay, so it obviously didn't help, but in the meantime I made an accessory that lazily creates an instance of DBIx :: Class, so that might be a little better. Check this:
sub schema { my $self = shift; unless ($self->{schema}) { $self->{schema} = ACD::Model->connect(@{$self->cfg->{$ENV{MODE}}->{connect_params}}); } return $self->{schema}; }
and then of course use it, you would do something like:
$self->schema->resultset('Foo')->find(1234);
source share