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

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


Richard Jones wrote:
> Hi Mark,
> 
> Appreciate the reply.
> 
> Mark Stosberg wrote:
>> And one other suggestion: If you find you are doing this a lot:
>>
>>     $c->param('model')
>>
>> Go ahead and make a simple shortcut method for it, so you can just say
>>
>>  $c->model;
> 
> 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.

rhesa


More information about the cgiapp mailing list