[Catalyst] using Catalyst::Model::CDBI

Alan Humphrey alan.humphrey at comcast.net
Thu Mar 31 00:32:13 CEST 2005


I must be missing something obvious.  I'm trying to follow the examples
given in the Intro document to set up my model class.  I think I've got
everything set up the way the doc shows, but it doesn't work.

App:

package BirdWeb::Admin;

use strict;
use Catalyst qw/-Debug/;

our $VERSION = '0.01';

BirdWeb::Admin->config(
    name => 'BirdWeb::Admin',
    root => '/home/alanh/birdweb/trunk/BirdWeb-Admin/root',
);

BirdWeb::Admin->action(

    '!default' => sub {
        my ( $self, $c ) = @_;
        $c->res->output('Congratulations, BirdWeb::Admin is on
Catalyst!');
    },

    'list' => sub {
		my ( $self, $c ) = @_;
		$c->stash->{item} =
BirdWeb::Admin::M::BirdWebDB::Birds->retrieve(1);
		$c->res->output($c->stash->{item});
    }

);

BirdWeb::Admin::M::BirdWebDB :

package BirdWeb::Admin::M::BirdWebDB;

use strict;
use base 'Catalyst::Model::CDBI';

__PACKAGE__->config(
    dsn           => 'dbi:mysql',
    user          => 'xxxxx',
    password      => 'xxxxx',
    options       => {},
    relationships => 1
);


When I try to run the 'list' action I get this error:

Caught exception "Can't locate object method "retrieve" via package
"BirdWeb::Admin::M::BirdWebDB::Birds" (perhaps you forgot to load
"BirdWeb::Admin::M::BirdWebDB::Birds"?) at
/home/alanh/birdweb/trunk/BirdWeb-Admin/script/../lib/BirdWeb/Admin.pm
line 22,  line 11."

What am I missing?

Thanks!

- Alan




More information about the Catalyst mailing list