[Catalyst] Re: question for mst : using $c->config->{blah} ...

J. Shirley jshirley at gmail.com
Mon Aug 4 03:27:53 BST 2008

On Sun, Aug 3, 2008 at 9:30 AM, Daniel McBrearty
<danielmcbrearty at gmail.com> 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?

It's all merged properly if you use ConfigLoader.

In your MyApp.pm if you have:

    'Model::Foo' => { bar => 'baz' }

And in MyApp/Model/Foo.pm you have:

    bar => 'foo'

If you have a method in Model::Foo, $self->{bar} will be equal to 'baz'.

The order is always Component -> App -> External Conf.  External Conf
has other orders, but that's another email.

You never want to use $c->config because $c->config->{'Model::Foo'}
should, and in most cases will, be equal to $self->{...} config keys,
you aren't guaranteed that.

You are, however, guaranteed that $self->{...} keys are populated from
config after component construction (component time, I believe)

(mst, feel free to correct me if I got any points wrong :))

More information about the Catalyst mailing list