[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cgiapp] Re: cgi::application::plugin::session question



On Sep 29, 2004, at 8:34 AM, Mark Stosberg wrote:

On 2004-09-29, Sean Davis <suppressed> wrote:

   $self->param('dbh' => DBI->connect($dsnnlt,
				     $nltuser,
				     $nltpass
				    ))
     or croak "Database connection not made: $DBI::errstr";

Hmm... looks like a good use for ::Plugin::DBH  :)

   my $sid = $self->query->cookie("CGISESSID") || undef;
   $self->session_config(
     CGI_SESSION_OPTIONS => ['driver:MySQL',$sid,
			    {Handle=>$self->param('dbh')}],

I think this is what is happening: You are trying to initialize
the session with a value from a cookie which doesn't exist, so it's
creating a new session instead. The standard idiom is to initialize
from the CGI object. This will check both the cookie and the CGI params
for a value, and then create a new session if niether is found. So:

 s/$sid,/$self->query,/


Mark,

Thanks for pointing out ::Plugin::DBH. I plan on using it, also, but the project started prior to the release and I just haven't changed over yet.

I used the idiom you suggest (both originally, and again, just to be sure). It seems like the cookie is never being created? I am using Template Toolkit for my templating and include a header in the template. Is this an issue?

Sean


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
             http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.