[Catalyst] Model::DBIC not working? Because of DBIx::Class::Loader?
Jules Bean
jules at jellybean.co.uk
Wed Nov 2 13:49:36 CET 2005
OK, I tried to get the DBIC model working this morning.
First attempt, helper script dies:
script/myapp_create.pl model DBIC DBIC 'dbi:Pg:dbname=myapp' 'postgres' ''
created "/Users/jules/work/myapp/MyApp/script/../lib/MyApp/M/DBIC.pm"
Can't locate object method "storage" via package
"DBIx::Class::Loader::Pg" at /Library/Perl/5.8.6/DBIx/Class/Loader/Pg.pm
line 95, <DATA> line 1.
Second attempt, let's not bother to use the helper script, lets just use
the model directly.
./myapp_server.pl -r
Couldn't instantiate component "MyApp::M::DBIC", "Can't call method
"classes" on an undefined value at
/Library/Perl/5.8.6/Catalyst/Model/DBIC.pm line 67." at
/Library/Perl/5.8.6/Module/Pluggable/Fast.pm line 86
Compilation failed in require at ./myapp_server.pl line 13.
Now that's weird, so I look at DBIC.pm, and I notice the following
auxiliary problem. Clearly $self->loader must be null, but that means
the eval is failing? So why am I not seeing those debug messages?
Apparently $c->log->debug doesn't work this early in the setup cycle. So
I put in some print STDERRs there into DBIC.pm and I find that the real
error (the contents of $@ after the eval) is:
Can't locate object method "storage" via package
"DBIx::Class::Loader::Pg" at /Library/Perl/5.8.6/DBIx/Class/Loader/Pg.pm
line 95.
OK now that's weird. I chased around the code in DBIx::C::L::Pg for a
while but I couldn't fully grok the inheritance strategy of
DBIx::Class::Componentised. It seems that 'storage' lies in
DBIx::C::DB.pm, but that never ends up on the ISA stack of
DBIx::C::L::Pg but I don't know how it is supposed to get on the ISA
stack and why it doesn't.
Jules
More information about the Catalyst
mailing list