Don't ask to ask, just ask | |
PerlMonks |
SOLVED: How to create sessions via FastCGI?by Ray.Zachary (Acolyte) |
on Jul 29, 2010 at 12:27 UTC ( [id://851922]=perlquestion: print w/replies, xml ) | Need Help?? |
Ray.Zachary has asked for the wisdom of the Perl Monks concerning the following question:
Hey guys, I thought CGI::Session could work fine with CGI::Fast for creating & manipulating Sessions. For this is the first time I use FastCGI, I wrote a test script first: This looks fine when I run this script with `perl /var/www/htdocs/index.fcgi` under command line, it created a session file under "/tmp". But when I access this page via web browser, it won't create a session file(at least there's no new session file in /tmp), but the page output was fine(include the value of $var). Do you have any idea with this? Thank you Almut, for helping me again, you are so cool. And thanks to everyone here. This problem has solved by add a statement "$session->flush();" to the last line of loop. As cpan said: flush() Synchronizes data in memory with the copy serialized by the driver. Call flush() if you need to access the session from outside the current session object. You should call flush() sometime before your program exits. As a last resort, CGI::Session will automatically call flush for you just before the program terminates or session object goes out of scope. Automatic flushing has proven to be unreliable, and in some cases is now required in places that worked with CGI::Session 3.x. Always explicitly calling flush() on the session before the program exits is recommended. For extra safety, call it immediately after every important session update. I was confused, I thought flush() was just like delete(), because that word made me to think of "flushing a toilet". haha
Back to
Seekers of Perl Wisdom
|
|