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?

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.

My preferred trick is to start off with a config file tailored to how the
user sees it and wrap finalize_config to mangle it into appropriate
components' config - see for e.g.

http://code2.0beta.co.uk/reaction/svn/Reaction-Example-MailerForm/1.000/trunk/lib/MailerForm/ConfigFilter.pm

and

http://code2.0beta.co.uk/reaction/svn/Reaction-Example-MailerForm/1.000/trunk/t/config_filter.t

for some simple mangling code and the end result - example configfile is at

http://code2.0beta.co.uk/reaction/svn/Reaction-Example-MailerForm/1.000/trunk/mailerform.conf

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/

_______________________________________________
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/

Reply via email to