Some people argue that with an MVC architecture, the database handle should never reside in the controller, and should only be accessible in the model, e.g.
http://www.oreillynet.com/onlamp/blog/2007/06/what_is_mvc.html I'd be interested to know how other C::A people implement this in their apps. > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:cgiapp- > [EMAIL PROTECTED] On Behalf Of Mark Fuller > Sent: Tuesday, 18 March 2008 9:34 a.m. > To: CGI Application > Subject: Re: [cgiapp] code reuse. > > James, > > Another thought. If these routines are meant to be reused among > various C::A applications, have you considered making (one or more) > superclass that you're application is a base of? Like the following? > This way you could have myapp1, myapp2, etc. that inherit from > "superclassMyApp". Which inherits from "superclassWebApp." With a > hierarchy like this you could keep extremely common things in the > highest level. Things that are application specific in lower levels. > You're dbh, uuid and logging routines might go in the top-most level. > > =========== > package myapp; > > use base 'superclassMyApp'; > > [Methods specific to your application, like setup and actual run modes]. > > etc... > > 1; > =========== > > package superclassMyApp; > > use base 'superclassWebApp'; > > [common methods. Maybe cgiapp_init goes here.] > > 1; > =========== > > package superclassWebApp; > > use base 'CGI::Application'; > > [even more common methods. Maybe cgiapp_get_query goes here if you're > using CGI::Simple.] > > 1; > ============ > > ##### 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/ ## > ## ## > ################################################################ ##### 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/ ## ## ## ################################################################