[Dbix-class] Catalyst::Model::DBIC::Schema

Maurice Height mauriceh at bigpond.net.au
Mon Mar 6 00:29:14 CET 2006


I get an error when trying to access data with DBIC in Catalyst.
I am sure I am doing something dumb like not doing a "connect" first
but I can't figure out how that is done from the
Catalyst::Model::DBIC::Schema docs.

I have a Model class, built with Catalyst::Helper::Model::DBIC::Schema
 
package MyApp::Model::MyMod;
use strict;
use lib 'C:/MyCode/DB_Apps/ShareMan/Code';
use DB_Schema;
use base 'Catalyst::Model::DBIC::Schema';
__PACKAGE__->config(
    schema_class => 'DB_Schema',
    connect_info => [ 'DBI:mysql:database=shareman',
                      'root',
                      '....',
                      {},
                    ],
);

Then in controller MyApp I have:

sub some_data : Global {
    my ($self, $c) = @_;	
    my $rs = $c->model('DB_Schema::History')->find('BHP','2006-02-03'); # 94
    .....
}

I get the error:
Caught exception in MyApp->some_data "Can't call method "find" on an
undefined value at C:/TEST/MyApp/script/../lib/MyApp.pm line 94."

Thanks
Maurice





More information about the Dbix-class mailing list