in reply to Problem with CGI::Session module -- Getting a new session every time
I suspect it may be that you are not actually writing the session file, probably due to File::Spec::tmpdir returning a dir you can't write. CGI::Session fails silently in this case. Try adding END{ warn $session->error } to pick up any errors.
You are making harder work of it than required. Try something like this with a hard coded tmpdir file. CHECK to see that your session files are getting written there.
my $q = CGI->new; # this will return a session object. # if the CGISESSID is avialable via cookie or param # that is what's used, otherwise it is a new session my $session = new CGI::Session("driver:File", $q, {Directory=>'/tmp'}) +; # this prints a header with the CGISSESSID cookie: print $session->header() # now if you want to stick it in a form as well, get the SESSID my $sessid = $session->id; # and stick it in the form..... print <<HTML; <form> <input type="hidden" name="CGISESSID" value="$sessid"> </form> HTML
cheers
tachyon
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Problem with CGI::Session module -- Getting a new session every time
by larryp (Deacon) on Nov 04, 2004 at 17:52 UTC |