[CDBI] Newb - CDBI and Sessions

Perrin Harkins perrin at elem.com
Wed May 24 04:29:13 BST 2006


On Tue, 2006-05-23 at 22:20 -0400, Scott R. Prelewicz wrote:

> i am new to Class:DBI and am confused on the best way to handle
> session data with CDBI. I usually use CGI::Session to handle my
> sessions, and I can't wrap my head around trying to implement that
> with CDBI.

One way would be to just pass CGI::Session the database handle from
Class::DBI and use it normally.  You can pass it an open database
handle.  You can get the handle from your Class::DBI class by calling
My::Class->db_main().

> I may not be getting something, where a separate session module may
> not be needed and CDBI can do all session and persistence work itself.

You need something to generate IDs, but sure, after that it could.  What
CGI::Session does is take a hash, run it through Storable, and save it
in a simple table.  You can do that yourself if you want.  I don't see
any reason to bother though, if you like CGI::Session.

- Perrin




More information about the ClassDBI mailing list