[cgiapp] code reuse.
Mark Fuller
azfuller at gmail.com
Mon Mar 17 16:34:15 EDT 2008
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;
============
More information about the cgiapp
mailing list