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

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


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,/

See CGI::Session::Tutorial for more detail. 

	Mark	

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


---------------------------------------------------------------------
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.