[Catalyst] How does config work?
phaylon
phaylon at dunkelheit.at
Fri Aug 12 21:56:20 CEST 2005
Christopher H. Laco said:
> How does config work in modules other than MyApp root?
As I understand from Catalyst::Base, the model class has it's own config,
independent from the App's config.
> The same doesn't seem to be true within a view, controller or model:
>
> MyApp::C::Email;
> __PACKAGE->config(emailfoo => 'bar');
> ...
> Then in TT: c.config.emailfoo during a request to /doit gets me
> nothing. What am I doing wrong?
The context object returns the applications config. I'm not a TT crack,
but I'd say there should be a possibility to access the template object.
> I see WritingPlugins mentions that it's good practice to save module
> specific config in a seperate module-named hash under config... where
> does config information go when I do this in a an M, V, C that's not the
> root...
Yep, but more for plugin modules. There you can store your information
under the applications config by using $c->config. You could use the
config of your application by using "MyApp->config", but that would bind
your models to Catalyst, as I understand it.
hth,
p
More information about the Catalyst
mailing list