[Catalyst] DBIx::Class, Class::DBI in catalyst wierdness.

Matt S Trout dbix-class at trout.me.uk
Wed Nov 9 19:56:30 CET 2005


On Wed, Nov 09, 2005 at 06:49:42PM +0100, Jesper Krogh wrote:
> 
> Hi
> 
> I'm trying to grok this Catalyst-thing but I've ran into this wierdness.
> 
> I would like to use DBIx::Class and the loader functions from
> this class and when I do so from the perl-script and issues:
> my $loader = new DBIx::Class::Loader(
>     dsn => $conf->{dsn},
>     password => $conf->{password},
>     user => $conf->{user},
>     namespace => "App"
> );
> 
> my $proj = App::Projects->find(148);
> print $proj->projectname() . "\n";
> 
> It works fine.
> 
> When I do the excact same thing from within Catalyst I get this
> errormessage:
> Use of uninitialized value in concatenation (.) or string at .. the line
> where i print "projectname".
> 
> -----
> use base 'Catalyst::Model::DBIC';
> 
> __PACKAGE__->config(
>     dsn => Core->config->{dsn},
>     password => Core->config->{password},
>     user => Core->config->{user},
>     debug => 1
> );
> 
> -----
> 
> Switching to Class::DBI (and retrieve instead of find) in Catalyst
> solves the problem.
> 
> According to the debug output of Catalyst the tables gets loaded
> fine, and I get all the classes (with debug I can see that the attributes
> get parsed fine too).
> 
> The database is a PostgreSQL-database.
> 
> I'm new to all of this, so please let me know if I've missed something
> obvious?

DBIx::Class::Loader is a pretty much straight port of Class::DBI::Loader so
there shouldn't really be a difference. You could try setting DBI->trace(1)
or similar to get all queries to the db output, and/or setting the env. var
DBIX_CLASS_STORAGE_DBI_DEBUG to a true value to get the DBIx::Class Storage
object to dump out the SELECT statement (but not the stuff Loader runs).

-- 
     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/ +



More information about the Catalyst mailing list