[Catalyst] Class::DBI::Loader borging too much too fast?

Sebastian Riedel sri at oook.de
Wed Jul 6 21:13:21 CEST 2005


Am 06.07.2005 um 20:18 schrieb Andy Grundman:

> Dominique Quatravaux wrote:
>
>> Also, I'm afraid that saying "use MyApp::M::Foo" in a piece of code
>> outside the Web app (e.g. a cron script) is not going to work,  
>> because
>> the Class::DBI::Loader singleton has to be created before the
>> persistence part of MyApp::M::Foo will work (see my earlier thread
>> "Initialization ordering, how?" starting at
>> http://lists.rawmode.org/pipermail/catalyst/2005-June/000769.html ).
>> And of course, a model class without the persistence is much less  
>> fun.
>> In other words, MyApp::M::Foo doesn't correctly encapsulate it's
>> persistence aspect.
>> To close the two issues at once, I'd like Class::DBI::Loader->new 
>> () to
>> refrain from borging everything at startup, and be taught to borg
>> piecewise and when requested. I'd like to be able to say:
>>
>
> Since you seem to have some fairly complex requirements, you may  
> just want to stop using Loader completely.  I don't use Loader in  
> any real applications myself, and prefer to create my model classes  
> manually so I can have more control over my relationships,  
> especially many-to-many relationships which aren't handled by  
> Loader.  Also, you don't need to inherit from Catalyst::Model::* if  
> you don't want to, and not doing so will enable your classes to be  
> used without hassle in a non-Catalyst cron job for example.

Newer Class::DBI::Loader releases can also dump the generated code  
(just enable debug), so you can use it to bootstrap a  
Catalyst::Model::CDBI::Plain based model.


--
sebastian




More information about the Catalyst mailing list