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.

#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################

Reply via email to