[Catalyst] Two questions regarding components

Bernhard Bauer bauerb at in.tum.de
Tue Jun 28 16:55:15 CEST 2005


Hi everyone,

First of all, I'd like to congratulate you on your excellent  
framework, but I have two issues/questions regarding components:

1. As far as I can tell, every component is require'd and  
instantiated via new(). The instances are then stored in $c- 
 >components->{$component_name}, making them some sort of singleton  
objects. While this makes sense to me for controllers (which don't  
carry a state) and views (which really are Adapters to the respective  
template system), I see some problems here for models.

Specifically, is there a way to make new() in the base class for your  
application models setup the model (and return the package name for  
example) while having new() in a derived class return a new instance?  
Or could the Engine maybe call a method shared_instance() which  
returns the singleton instance of the component, while new() returns  
a new instance every time it is called?

2. Is there a way for a plugin (or component) which depends on  
another plugin to load it? For example, have a controller which uses  
Catalyst::Plugin::Textile load it at startup without having to  
explicitly specify it in the plugin list?

Thanks in advance for your help,

Bernhard Bauer


-- 
Bernhard Bauer

bauerb at in.tum.de

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4228 bytes
Desc: not available
Url : http://rawmode.org/pipermail/catalyst/attachments/20050628/ef7f4e84/smime.bin


More information about the Catalyst mailing list