[Catalyst] Catalyst::Model::CDBI::CRUD observation

Michael Reece mreece at sacbee.com
Fri Apr 29 18:36:49 CEST 2005


As you are discovering, that CRUD class is pretty much useless, except
perhaps as an example of what not to do.

Much like the templates should not be responsible for retrieve_all, the
model class should not be responsible for dispatching CRUD actions, and
shouldn't be calling any method the model can().

After poking at CRUD for a couple of days, you will end up doing that others
have done, which is writing your own CRUD controller.

On 4/29/05 9:14 AM, "Will Hawes" <info at whawes.co.uk> wrote:

> With regard to the handling of CDBI objects in the above module. The process()
> method (line 124) stashes the class for the current request and, if an id is
> present in the URL, does a retrieve and stashes the returned item. But if no
> id is present, no CDBI objects are created.
> 
> In Hops, the objects are actually created in the "list" template, which does
> class->retrieve_all and builds a HTML table. So the data is being retrieved in
> the View part of the app?!
> 
> It's late on Friday and maybe I'm missing something here, but surely CRUD.pm
> should be following Maypole's example and stashing an array(ref) of CDBI
> objects to pass to the template instead.
> 
> Regards
> 
> WH





More information about the Catalyst mailing list