[cgiapp] Model design in C::A/Titanium

Rhesa Rozendaal perl at rhesa.com
Tue Sep 23 16:04:29 EDT 2008


Joshua Miller wrote:
> On Tue, Sep 23, 2008 at 10:07 AM, Porta <julian.porta at gmail.com> wrote:
> 
>> I guess that I'm missing something here, because I don't see why you
>> need to crowd all the models into a single one. You can still decouple
>> the models from the controllers if every subclass of WebApp::DB knows
>> how to interact with the database. Then, instead of
>>
>>    $c->param('mode')->get_foo();
>>
>> you'll do:
>>
>>    my $foo = WebApp::DB::Foo->new;
>>    $foo->get_all();
>>
>> Where get_all is a sub inherited from WebApp::DB.
>>
>>
> My 2 cents... I'd rather call it like so:
> 
> $c->model->foo->get()


Or $c->model('Foo')->get();

rhesa


More information about the cgiapp mailing list