On Mon, Aug 4, 2008 at 11:14 AM, Matt S Trout <[EMAIL PROTECTED]> wrote: > On Sun, Aug 03, 2008 at 06:30:02PM +0200, Daniel McBrearty wrote: >> wait, it is on $self not $c, so my reservations don't really apply. >> >> but what about reall config stuff that can change from one >> installation to another? then you have to do $c->config->{my_var}, >> right? > > How isn't something like connect_info real config? >
By "real config", I mean stuff which is entirely specific to the app, and not generic for a particular Cat component. An example might something like email addresses that input from a certain form is sent to. Maybe "real" wasn't the best word. > Put the config in a block specific to the model/view/controller that needs > it and access stuff from within that component via $self->{whatever}, for > preference. > > $self->config is broken since it only gives you the class level defaults > which is why you should never call it. > > $c->config is an acceptable workaround for the fact we don't have a seperate > app object so you can't do $c->app->my_var yet, but you should try and avoid > needing it wherever possible. > In my app, I have done it rather differently - anything that is "config" is in the config file - class level or whatever. And everything is accessed using $c->config->{whatever} The reason I like this is simplicity - if it says "config", I know where to find it, end of story. Just a personal preference. I guess if it isn't broken or likely to cause issues (it's been like that for a year and half now) I'm not going to worry about it. Thanks for the clarification. _______________________________________________ List: Catalyst@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/