[Catalyst] The model -is- where your business logic lives.

Pedro Melo melo at simplicidade.org
Thu Sep 27 12:16:49 GMT 2007


Hi,

On Sep 27, 2007, at 11:51 AM, Ian Docherty wrote:

> In a previous thread, Matt S Trout said.
>
>> The model -is- where your business logic lives.
>>
>> The real question is whether your ORM should be directly in the  
>> model or
>> not, but that's a whole different thread.
>
> Based on this I have the following simple code.
>
[....]
>
> Is this a standard/typical/best-practice way to do this sort of thing?

That's what I do with two minor adjustements:

  * I started using load_namespaces to control each source resultset  
class also;
  * I don't put my model inside the catalyst application.

> It seems to me that if I want to use the business logic in an  
> external application (cronjob) then I am having to use the  
> MyApp::Model::DBIC::Demo namespace as decreed by Catalyst (not that  
> this is a big issue).

se 2) above. Most of the time I have Demo::Controller, Demo::Model,  
Demo::View, and my schema is Demo::Schema.

So I can use Demo::Schema in all my crons.

See the SYNOPSIS of http://search.cpan.org/perldoc? 
Catalyst::Model::DBIC::Schema on how to do it.

Best regards,
-- 
Pedro Melo
Blog: http://www.simplicidade.org/notes/
XMPP ID: melo at simplicidade.org
Use XMPP!





More information about the Catalyst mailing list