[Catalyst] Store something in the stash at startup

Tomas Doran bobtfish at bobtfish.net
Tue Aug 17 15:24:12 GMT 2010


On 17 Aug 2010, at 15:50, Charlie Garrison wrote:
>
> I was suggesting the Moose attribute as way of storing the model in  
> $c to be easier to reference from templates.

I highly recommend taking the model instance and stashing it (as is  
being done already), rather than making an attribute on the context  
object, as this is less flexible...

I.e. if you are saying [% c.model('Foo').thing %] or [% c.foo.thing %]  
then this is less flexible (as you can't override foo for part of your  
site) than $c->stash(foo => $c->model('Foo')) in your perl code, then  
[% foo.thing %] in your template.

Cheers
t0m




More information about the Catalyst mailing list