[Catalyst] Config-only components

Jonathan Rockway jon at jrock.us
Thu Feb 14 04:38:22 GMT 2008


* On Wed, Feb 13 2008, Todd Harris wrote:
> I just took a cursory look at your patch.  It doesn't handle seeding
> dynamically registered actions with coderefs, it's just intended to
> create the appropriate components, correct?

Here's the idea.  Say you have a base class like:

  package ...::ControllerBase::Foo;

  sub entity {
     ref $self =~ /::Controller::(\w+)$/;
     return lc $1;
  }

  sub create :Local {
    $f = $c->model('Forms', $self->entity)->create_from_req($c->req);
    $c->view->template( $f->template );
  }
  ...

Normally you would have to make a bunch of almost-empty files like:

  package ...::Controller::Thingies;
  use base '...::ControllerBase::Foo';
  1;

With ilmari's patch, you can just create these classes in a config file
instead of on disk.  Much quicker.

Regards,
Jonathan Rockway




More information about the Catalyst mailing list