From: dmcnulty@... (Dan McNulty) Date: 2002-02-16T01:00:23+09:00 Subject: CGI::Session problems Argh! I am trying to using CGI:Session (with Apache & mod_ruby) and meeting no success. I have read what little there is about sessions in the two books I have, and scoured the 'net for examples (and found a few). The code I am using is like this: def getsession(cgi) if $sess == nil then $sess = CGI::Session.new(cgi, "session_key" => "a_test", "prefix" => "rubysess.") end return $sess end cgi = CGI.new sess = getsession(cgi) if sess["junk"] != nil puts "An existing session" puts Marshal.load(sess["junk"]) sess.update else puts "A new session" sess["junk"]=123 end The function getsession() is defined in a loaded file. The problem is that sess["junk"] is always nil, like session isn't being stored or restored. I would really love a simple example of this working under mod_ruby. I think perhaps mod_ruby is whacking my "cgi" object after every run. Since I need the session for variable persistance, this is not a good thing. Thanks for any help! -- Dan