[Catalyst] Dynamic model and controller creation
bobtfish at bobtfish.net
Mon Jan 2 16:44:46 GMT 2012
On 2 Jan 2012, at 16:30, Bill Moseley wrote:
> On Mon, Jan 2, 2012 at 6:42 PM, Tomas Doran <bobtfish at bobtfish.net>
> Why are you messing around with ACCEPT_CONTEXT to do this?
> Why not just use COMPONENT to return the service class once?
> Oh, I'm glad you brought that up.
> Where Model::Foo does use Model::Adaptor. Maybe I could work with
> setup_components to make sure the model instances are created in the
> correct order (or user Bread::Board as discussed earlier).
Gotcha! Yes, that's then totally valid - and one of the things that
_should_ be simple, but isn't right now.
As you note - you can mess around with the model load order to ensure
things work - letting you have everything setup at startup time - if
that (the setup at startup time) is a significant advantage or not is
of course your call - but messing with the load order obviously isn't
nice, or extensible!
This is one of the things that is very much solved by the Bread::Board
> Which is code to do exactly what you want - i.e. setup any models
> there is config for, but which don't have an explicit class on-disk,
> and then go on to setup controllers for each model setup.
> Sure does! Thanks,
No worries :)
More information about the Catalyst