[Catalyst] How does config work?

Christopher H. Laco claco at chrislaco.com
Fri Aug 12 22:06:54 CEST 2005


Sebastian Riedel wrote:
> 
> Am 12.08.2005 um 21:09 schrieb Christopher H. Laco:
> 
>> 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...
> 
> 
> It goes into the instances.
> 
>     $c->comp('MyApp::C::Email')->{foo};
> 
> 
>     package MyApp::C::Email;
>     sub do_stuff {
>         my ( $self, $c ) = @_;
>         $self->{foo};
>     }
> 

So, if I have a model, say MyApp::Model::CDBI that calls 
__PACKAGE__->config(dsn =>'foo'), that config is in:

	$c->comp('MyApp::Model::CDBI')->{dsn)

Now, does that mean that most of these Model base modules are doing 
something like:

	$c->comp(caller[0])->{dsn}

to get the config set by the users models?

-=Chris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3178 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.rawmode.org/pipermail/catalyst/attachments/20050812/5b3a1cba/smime.bin


More information about the Catalyst mailing list