[Catalyst] Catalyst::Manual::Cookbook and/or Catalyst::Model::CDBI::CRUD issue

Perrin Harkins perrin at elem.com
Wed Jun 22 09:20:13 CEST 2005


On Mon, 2005-06-13 at 06:26 +0200, Lars Balker Rasmussen wrote:
> samwyse wrote:
> > "Scaffolding is very simple with Catalyst. Just use
> > Catalyst::Model::CDBI::CRUD as your base class."
> > 
> > OK, I followed the example and got this:  <<Caught exception "Can't
> > locate object method "columns" via package
> > "MyApp::Model::MyCDBI::User" (perhaps you forgot to load
> > "MyApp::Model::MyCDBI::User"?) at
> > /home/dentos/MyApp/script/../lib/MyApp.pm line 105.">>

[...]

> : but besides this, why do I get the error 'Couldn't forward to
> : "MyApp::M::CDBI::Magasin". Invalid or not loaded.'?

I believe both of you are being caught by the aliasing of
MyApp::Model::CDBI:: and MyApp::M::CDBI::.  Consider this method

sub manage_petitions : Global {
    my ( $self, $c ) = @_;
    $c->form( optional => [ Poli::M::DB::Petition->columns ] );
    $c->forward('Poli::M::DB::Petition');
}

If I change the first M to Model, I get the error about "Can't locate
object method..."  If I change the second to Model, I get the "Couldn't
forward to..." error.  Both seem to stem from confusion about what class
names the Catalyst::Model::CDBI module generates, and where you can use
aliases for your M, V, and C modules.

> IT appears to be the same problem.

Probably also the name issue, but for V and View.

> The consensus seems to be: Don't use the CRUD module.

It's working fine for me, although I agree with others that it seems
like it belongs as a controller in Catalyst's world, not as a model base
class.

I realize that Catalyst is aiming for more complicated apps than
Maypole, but having a viable automatic CRUD is pretty handy and has
become a feature comparison point, since RoR, OpenInteract2, and Maypole
all do it.

- Perrin




More information about the Catalyst mailing list