On Mon, Aug 12, 2002 at 04:12:02PM -0700, Michael G Schwern wrote:
> On Mon, Aug 12, 2002 at 07:56:57AM +0100, Tim Bunce wrote:
> > They (slightly) have different semantics so I'd be reluctant to
> > transparently substitute one for another.
> 
> Fair nuff.
> 
> 
> > But how about a new method:
> > 
> >   DBI->connect_method("connect");
> >   DBI->connect_method("Apache::DBI::connect"); # effectively what "use 
>Apache::DBI;" does now
> >   DBI->connect_method("connect_cached");
> 
> Useful, but doesn't solve the problem.

Actually it would. I wasn't very clear. The application would do

        DBI->connect_method("connect_cached");
and
        $dbh = DBI->connect(...);

When not run under Apache::DBI you'd get connection caching via
connect_cached and when run under Apache::DBI it could ignore the
connect_method and force Apache::DBI::connect (by default).

Or just add

        DBI->connect_method("connect_cached") unless $INC{'Apache/DBI.pm'};

Would that be okay?

Tim.

> I had assumed DBI->connect_cached() was just intellegently deciding whether
> to use Apache::DBI or DBI's own caching mechanism, that way DBI programmers
> just didn't have to worry about whether their program was running under
> mod_perl or stand-alone.  DBI would just figure out the right sort of
> caching to do.
> 
> With the current situation, one has to have logic like this in their DBI
> programs:
> 
>      if( we're running under mod_perl ) {
>        connect using Apache::DBI
>      }
>      else {
>        connect using DBI->connect_cached
>      }
> 
> the suggestion above just makes the "connect using" part a bit easier, but
> doesn't solve the problem of having to manually choose.  For myself this
> isn't much of a problem, I can just put the logic into Ima::DBI.
> 
> 
> -- 
> 
> Michael G. Schwern   <[EMAIL PROTECTED]>    http://www.pobox.com/~schwern/
> Perl Quality Assurance      <[EMAIL PROTECTED]>         Kwalitee Is Job One
> Death?  Its like being on holiday with a group of Germans.

Reply via email to