[Catalyst] Base controllers and multiple inheritance
Peter Karman
peter at peknet.com
Thu Mar 6 02:54:12 GMT 2008
Byron Young wrote on 3/5/08 4:29 PM:
>
> Everything looks good, right? My List actions work! However, the CRUD
> actions don't work because the FormConfig actions seem to have been
> ignored -- $c->stash->{form} is undef :(
I wouldn't expect anything in stash() to persist from request to request. Don't
do anything with stash during new(). new() is called once per app life, at
startup. stash() is for each request.
>
> Does anyone have any suggestions? Should I just forego using new() and
> do initial setup the first time auto() is called in each of my base
> controllers?
depends on what kind of thing you are setting up. I have used multiple
inheritance in my controllers to good effect (see CatalystX::CRUD::Controller
and its descendents for example). In general, only set up things in new() (or
its cousins) for stuff you want to set up once per app: config, persistent
objects, etc. IME, there isn't much you want like that.
--
Peter Karman . http://peknet.com/ . peter at peknet.com
More information about the Catalyst
mailing list