On 2004-10-03, Cees Hek <[EMAIL PROTECTED]> wrote:
>> 
>> 1. A purely orthogonal module
>> 
>> Here, the helper module has no dependency or relation to
>> CGI::Application. Most other modules you might employ from CPAN would
>> fall into this category. For example, using CGI::Simple, SQL::Abstract
>> or Data::Grouper.
>> 
>> In many ways, this is the ideal setup, because the lack of
>> interdependence reduces the overall complexity of your application. 
>
> I think this is the cleanest way to implement database access in 
> CGI::App, and I would think that Class::DBI falls into this category as 
> well.

I agree here. 

>> Unfortunately, writing this of module for a custom solution can tedious
>> if there /are/ a lot of interdependencies you want to consider, such as
>> sharing configuration data, a database handle, session information or
>> CGI query parameters. 
>
> Of the dependancies you list, I believe only configuration data should 
> be shared between your CGIApp modules and your database modules.  And 
> that can be handled by sharing the same configuration files (I usually 
> just use a perl module that defines all the variables that are needed 
> and 'use' it in all my modules).
>
> CGI parameters and session info should not need to be accessed directly 
> by the database modules.  The Database modules shouldn't even care that 
> you are working in a CGI environment or on the command line, or even a 
> SOAP app.

I generally agree here as well. 

> As for the database handle, that should be managed by the database 
> module, not by the CGI::Application module.  I guess this isn't an issue 
> for me, since Class::DBI manages the database handle for me.  I usually 
> do add a helper method to my CGIApp super class that retrieves the 
> database handle from Class::DBI in case I need to pass an open dbh to a 
> Session module or something like that.  But I never use it directly 
> myself, it is only there for third party modules that require database 
> access.

So it sounds like you advocate using Ima::DBI, the solution that
Class::DBI uses?

        Mark

-- 
http://mark.stosberg.com/ 


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[EMAIL PROTECTED]/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to