[Catalyst] Store something in the stash at startup

Octavian Rasnita octavian.rasnita at ssifbroker.ro
Wed Aug 18 05:25:34 GMT 2010


Yes, that was the thing I needed to remember.

I have also tried to use a Moose attribute and create the object in its
default, but that way it would really re-create the object on each request.

Thank you.

--
Octavian

----- Original Message ----- 
From: "Charlie Garrison" <garrison at zeta.org.au>
To: "The elegant MVC web framework" <catalyst at 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.rasnita at 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
>configuration file, but
>then it is used on each request to re-create the menu object.

Are you looking for this:

http://search.cpan.org/perldoc?Catalyst::Model::Adaptor

Specifically:

    "Note that NotMyApp::SomeClass is instantiated at application startup
time."


Charlie

-- 
   Ꮚ Charlie Garrison ♊ <garrison at zeta.org.au>

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
〠  http://www.ietf.org/rfc/rfc1855.txt

_______________________________________________
List: Catalyst at lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

__________ Information from ESET NOD32 Antivirus, version of virus signature
database 5371 (20100816) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




__________ Information from ESET NOD32 Antivirus, version of virus signature 
database 5374 (20100817) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




__________ Information from ESET NOD32 Antivirus, version of virus signature database 5374 (20100817) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com






More information about the Catalyst mailing list