[Catalyst] Making a hash available across the application

Dermot paikkos at googlemail.com
Wed Mar 17 17:43:07 GMT 2010


Hi,

I'm sure there is a way but it's not jumping out at me.

I have a list of countries and their associated database ID's that I
need to stash in the header of (almost) every page on a site. I have
no problems creating a controller that can do
$c->model(DB::Countries)->search({foo=>1}) and stick that into a
$c->stash but I don't want to make repeated DB calls. I'd like to
create a hash at startup and make it available to
root/lib/site/header. Is it possible to create a hash within
lib/MyApp.pm that will be available throughout and how would my
templates access it?

TIA,
Dp.



More information about the Catalyst mailing list