[cgiapp] Re: Model design in C::A/Titanium
Richard Jones
ra.jones at dpw.clara.co.uk
Tue Sep 23 17:45:53 EDT 2008
Rhesa Rozendaal wrote:
>> Did you have something like this in mind:
>>
>> sub model {
>> my $c = shift;
>>
>> return $c->param('model');
>> }
>>
>> Seems a bit, erm, 'trivial' ?
>
> That may be trivial today, but it gives you the freedom to make it much
> smarter, without having to change the calling code. You can't do that if
> you have $c->param('model') littered around the code base.
Right. Thanks for that - I was really just checking I'd interpreted
Marks suggestion correctly.
Actually I quite like the idea of grouping associated db-related method
calls into WebApp::Model::Foo, WebApp::Model::Bar, etc, but not sure
what is the best way to get them into the call to $c->model, so I can
call them as $c->model('Foo')->get_stuff,
$c->model('Bar')->update_stuff, etc. Pointers appreciated.
More information about the cgiapp
mailing list