On Tue, 12 Oct 2004 17:22:55 -0400, William McKee
<[EMAIL PROTECTED]> > > See, I'd rather have lots of plugins than
have a monolithic CGI::App
> core that I only use parts of. Of course, I'm in the camp that says
> HTML::Template should not be a requirement for C::A and that the
> load_tmpl function should be an abstract method that is implemented by a
> plugin. I wouldn't have a problem if the default plugin was
> C::A::P::HTML-Template (or whatever it'd be called) but am advocating
> stripping down C::A more than building it up :).

I agree with you here, even though I am not that worried about the
HTML::Template requirement in the core CGI::Application, cause I
usually have it installed anyway :)

> As an example, you suggested the dbh plugin being added to core which
> brings up an issue I've had tumbling around in the back of me head. As a
> CDBI user, I have yet to see a need for passing around a dbi handle.
> Mark's plugin looks interesting and perhaps I'm overlooking some great
> benefits that the list could point out for me. In the meantime, I'd
> rather than add the extra code to my applications if I'm not using it.

It can still be useful if another Plugin requires database access. 
When I use the C::A::P::Session module, I need to pass it a DB handle.
 Ususally I just do this:

sub db {
  my $self = shift;
  return MyCDB::Base->db_Main(); # grab $dbh from Class::DBI
}

and then configure the session plugin as follows:

$self->session_config(
            CGI_SESSION_OPTIONS => [ 'driver:PostgreSQL', 
                                                           $self->query,
                                                          { Handle =>
$self->db } ]
);

I could of course config the session stuff like this:

$self->session_config(
            CGI_SESSION_OPTIONS => [ 'driver:PostgreSQL', 
                                                           $self->query,
                                                          { Handle =>
MyCDB::Base->db_Main() } ]
);


But I like the abstraction of the first method better.  At some point
when I have more time, I will probably start using the DBH plugin for
this, as it standardizes things for me, even though I will probably
never directly use the dbh handle in my CGI::App modules.  I am slowly
removing all the code from my custom superclass and replacing it with
plugins.  This simplifies my apps, and makes them easier to maintain,
as well as less error prone (since more eyes are looking at and using
the code in the plugins).

Cheers,

-- 
Cees Hek

---------------------------------------------------------------------
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