On Mon, Nov 21, 2005 at 05:22:52PM -0500, Cees Hek wrote:
> On 11/21/05, Brett Sanger <swi...@sw...> wrote:
> > Is there way to pass CGI::Session an existing DB handle for use, rather
> > than a dsn and options?
> >
> > I've got a module that centralizes all the dsn info, and spits out the
> > handle, but the docs don't make it look like I can use it with
> > CGI::Session.
>
> From the postgres driver docs:
>
> $session = new CGI::Session("driver:PostgreSQL", undef,
> {Handle=>$dbh, TableName=>'my_sessions'});
In the subversion repo for CGI::Session, I've added support for
lazy-loading the handle:
$session = new CGI::Session("driver:PostgreSQL", undef,
{Handle=> sub{$dbh}, TableName=>'my_sessions'});
^^^^^^^^
This could improve the laziness if you are using this in conjunction
with the CGI::Application DBH and Session and plugins, which lazy load
themselves.
The change allows the database handle to only be created if the session
is actually used.
Mark
|