Re: [Catalyst] Store something in the stash at startup

2010-08-18 Thread Tomas Doran
On 18 Aug 2010, at 04:07, Charlie Garrison wrote: 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

Re: [Catalyst] Store something in the stash at startup

2010-08-18 Thread Charlie Garrison
Good evening, On 18/08/10 at 11:04 AM +0100, Tomas Doran bobtf...@bobtfish.net wrote: Does this make sense how this would work? I'm not saying you want this facility _right now_, just that when you come to want it, it's nice if your template is already flexible - which is why I'd try to have

Re: [Catalyst] Store something in the stash at startup

2010-08-18 Thread Charlie Garrison
Good evening, On 18/08/10 at 11:04 AM +0100, Tomas Doran bobtf...@bobtfish.net wrote: Does this make sense how this would work? I'm not saying you want this facility _right now_, just that when you come to want it, it's nice if your template is already flexible - which is why I'd try to have

Re: [Catalyst] Store something in the stash at startup

2010-08-17 Thread Charlie Garrison
Good afternoon, On 17/08/10 at 8:27 AM +0300, Octavian Rasnita octavian.rasn...@ssifbroker.ro wrote: $c-stash(menu = $c-model('Menu')); But this would re-create the menu object on each request, and this takes time. The data structure of the menu is loaded only at startup by the do() in the

Re: [Catalyst] Store something in the stash at startup

2010-08-17 Thread w...@serensoft.com
On Tue, Aug 17, 2010 at 6:23 AM, Tomas Doran bobtf...@bobtfish.net wrote: On 17 Aug 2010, at 06:27, Octavian Rasnita wrote: I load and store this object in the stash on each request in the Root::auto : Private method with: $c-stash(menu = $c-model('Menu')); But this would re-create the

Re: [Catalyst] Store something in the stash at startup

2010-08-17 Thread Charlie Garrison
Good morning, On 17/08/10 at 8:59 AM -0500, w...@serensoft.com wrote: On Tue, Aug 17, 2010 at 6:23 AM, Tomas Doran bobtf...@bobtfish.net wrote: No, it wouldn't. The adaptor you showed has a lifetime of the application, and so it won't be recreated each request. /lurk Hmm, this is

Re: [Catalyst] Store something in the stash at startup

2010-08-17 Thread Tomas Doran
On 17 Aug 2010, at 14:59, w...@serensoft.com wrote: Is that the part you're referring to as application-lifetime? No. When you say: use MyApp; (or require MyApp) then the application is loaded, and all of it's models, controllers and views are setup initially. They persist for the

Re: [Catalyst] Store something in the stash at startup

2010-08-17 Thread Tomas Doran
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

Re: [Catalyst] Store something in the stash at startup

2010-08-17 Thread Charlie Garrison
Good afternoon, On 17/08/10 at 4:24 PM +0100, Tomas Doran bobtf...@bobtfish.net wrote: 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

Re: [Catalyst] Store something in the stash at startup

2010-08-17 Thread Octavian Rasnita
From: Tomas Doran bobtf...@bobtfish.net On 17 Aug 2010, at 06:27, Octavian Rasnita wrote: I load and store this object in the stash on each request in the Root::auto : Private method with: $c-stash(menu = $c-model('Menu')); But this would re-create the menu object on each request, and

Re: [Catalyst] Store something in the stash at startup

2010-08-17 Thread Octavian Rasnita
To: The elegant MVC web framework catalyst@lists.scsys.co.uk Sent: Tuesday, August 17, 2010 9:27 AM Subject: Re: [Catalyst] Store something in the stash at startup Good afternoon, On 17/08/10 at 8:27 AM +0300, Octavian Rasnita octavian.rasn...@ssifbroker.ro wrote: $c-stash(menu = $c-model('Menu

[Catalyst] Store something in the stash at startup

2010-08-16 Thread Octavian Rasnita
Hi, I have a module that creates an object (a menu) and I want to store it in the stash when the application starts. Where is the recommended place to create this object and store it in the stash if I want that object created just once at app startup? Should I override a certain method in

Re: [Catalyst] Store something in the stash at startup

2010-08-16 Thread Charlie Garrison
Good evening, On 16/08/10 at 11:05 AM +0300, Octavian Rasnita orasn...@gmail.com wrote: I have a module that creates an object (a menu) and I want to store it in the stash when the application starts. Where is the recommended place to create this object and store it in the stash if I want

Re: [Catalyst] Store something in the stash at startup

2010-08-16 Thread J. Shirley
2010/8/16 Octavian Rasnita orasn...@gmail.com: Hi, I have a module that creates an object (a menu) and I want to store it in the stash when the application starts. Where is the recommended place to create this object and store it in the stash if I want that object created just once at app

Re: [Catalyst] Store something in the stash at startup

2010-08-16 Thread Robert Sedlacek
On 08/16/2010 09:32 PM, J. Shirley wrote: 2010/8/16 Octavian Rasnita orasn...@gmail.com: Hi, I have a module that creates an object (a menu) and I want to store it in the stash when the application starts. Where is the recommended place to create this object and store it in the stash if I