FAQ
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

Search Discussions

  • Matt S Trout at Nov 2, 2005 at 2:20 pm

    On Wed, Nov 02, 2005 at 12:49:36PM +0000, Jules Bean wrote:
    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.
    Componentised doesn't have an inheritance strategy really, it's a convenient
    way to *manage* inheritance strategies for things.

    Loader should set up a common base class for the table classes that's
    isa DBIx::C::DB and has the storage info set on it. This is pretty much
    the same as what compose_connection from DBIx::C::Schema does (although
    Schema does some extra magic to put the thing in its new namespace, of
    course)

    --
    Matt S Trout Specialists in Perl consulting, web development, and
    Technical Director UNIX/Linux systems architecture and automation. Mail
    Shadowcat Systems Ltd. mst (at) shadowcatsystems.co.uk for more information

    + Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedNov 2, '05 at 1:44p
activeNov 2, '05 at 2:20p
posts2
users2
websitecatalystframework.org
irc#catalyst

2 users in discussion

Matt S Trout: 1 post Jules Bean: 1 post

People

Translate

site design / logo © 2022 Grokbase