[Catalyst] CRUD for all tables in Catalyst 5

Alan Tam Tam at SiuLung.com
Mon Sep 12 21:45:23 CEST 2005


Hi,

I've read [1] which gave me 2 methods to populate CRUD methods for all 
tables, but both does not work here in Catalyst 5.

In particular, I tried this:
__PACKAGE__->set_action(
  'default', sub {
    my ($self, $c) = @_;
    for my $class ($c->comp("MyApp::M::CDBI")->loader->classes) {
      __PACKAGE__->action(
        $class->table => sub {
          my ($self, $c) = @_;
          $c->form( optional => [ $class ] );
          $c->forward($class);
        }
      );
    }
  },
  "",
  ["Global"]
);

The error is:
|Caught exception "Can't call method "loader" on an undefined value at 
lib/MyApp.pm line 14."|

Can anyone post the updated version which would work in Catalyst 5.33? 
Thanks!

-- 
Regards,
Alan

[1] http://lists.rawmode.org/pipermail/catalyst/2005-April/000174.html

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/catalyst/attachments/20050913/00983491/attachment-0001.htm


More information about the Catalyst mailing list