Re: [Catalyst] Making a hash available across the application

2010-03-30 Thread Dermot
On 17 March 2010 23:08, Tomas Doran wrote: > > On 17 Mar 2010, at 18:48, Ram Dobson wrote: >> >> I'm kinda new to Catalyst too, but i believe this is what one might call a >> "helper" function. Anybody who knows more have an opinion on the relative >> merit of my change? > > > Crapping stuff into

Re: [Catalyst] Making a hash available across the application

2010-03-18 Thread Alexander Hartmaier
Am Donnerstag, den 18.03.2010, 00:08 +0100 schrieb Tomas Doran: > > In fact, generally - you don't want to be calling the generic ->search > method in your controllers _at all_. > > The specific search functionality should instead be pushed down into > your ResultSet classes, so that you say: > > $

Re: [Catalyst] Making a hash available across the application

2010-03-17 Thread Tomas Doran
On 17 Mar 2010, at 18:48, Ram Dobson wrote: I'm kinda new to Catalyst too, but i believe this is what one might call a "helper" function. Anybody who knows more have an opinion on the relative merit of my change? Crapping stuff into the top level context class like that works, however

Re: [Catalyst] Making a hash available across the application

2010-03-17 Thread Ram Dobson
I might do it a little different, but i like this Jshirley On 3/17/2010 2:04 PM, J. Shirley wrote: [snip] -package MyApp::Schema; +package MyApp; use Moose; extends 'DBIx::Class::Schema'; -has something => ( +has my_hash => ( is => ro, lazy_build => 1 ); sub _build_somethi

Re: [Catalyst] Making a hash available across the application

2010-03-17 Thread J. Shirley
On Wed, Mar 17, 2010 at 9:43 AM, Dermot wrote: > 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

[Catalyst] Making a hash available across the application

2010-03-17 Thread Dermot
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

Re: [Catalyst] Making a hash available across the application

2010-03-17 Thread Ido Perlmuter
Catalyst applications are Perl applications just like anyone else. If you want to access a hash variable (or any variable) which is declared (and possibly defined) in MyApp.pm (or any module for that matter), then all you need to do is refer to that variable from external sources (like templates) b