[Catalyst] Dynamic model and controller creation

Tomas Doran 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>  
> wrote:
>
>
> 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.

<snip>

> 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  
branch..

> 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 :)

Cheers
t0m





More information about the Catalyst mailing list