Re: [CDBI] Newb - CDBI and Sessions

Perrin Harkins <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.class-dbi
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.