[Catalyst] Store something in the stash at startup

Robert Sedlacek rs at 474.at
Mon Aug 16 19:43:51 GMT 2010

On 08/16/2010 09:32 PM, J. Shirley wrote:
> 2010/8/16 Octavian Rasnita <orasnita at 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 startup?
>> Should I override a certain method in MyApp.pm and create the object there?
>> Thanks.
> That sounds exactly like a model class.

I agree and would like to add: If it's about providing some value for a
view no matter where it comes from, it might be best to extend the view
to stash the variable prior to rendering.

Robert 'phaylon' Sedlacek

Perl 5 Consultant for
Shadowcat Systems Limited - http://shadowcat.co.uk/

More information about the Catalyst mailing list