[cgiapp] Re: Combining DBIx::Simple and CGI::Session

Mark Stosberg mark at summersault.com
Wed Oct 1 22:05:40 EDT 2008


> > The docs for DBIx::Simple cleary warn about using the dbh() method to
> > get the db handle for use outside DBIx::Simple.
> > 
> > And yet, with CGI::Session, if I pass in a handle (returned from
> > DBIx::Simple or otherwise), I know CGI::Session will be doing queries
> > whenever it feels like it.
> > 
> > So, what to people do?
> > 
> > Use 2 handles, 1 via DBIx::Simple for all normal queries, and 1 via DBI
> > just for use with CGI::Session?
> 
> Actually, another possibility is to use 2 DBIx::Simple-based handles,
> one for all normal queries, and one to pass to CGI::Session but not ever
> use via DBIx::Simple.

I asked the author about this. I think it's not that the dual-life
handle causes problems inherinently, it's more of a "know what you are
doing" situation. If I recall the specific issue, DBIx::Simple does it's
own garbage collection, and you are encouraged to not mess that up,
which shouldn't be too hard.

> Recommendations?

My recommendation is to share the handle between DBIx::Simple and
CGI::Simple and test that your application doesn't blow up.

    Mark

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





More information about the cgiapp mailing list