>Normal use of CGI::Session - and the example in the documentation -
>seems to be only remembering a sesion for same browsing session. That
>is, even if a cookie is correctly stored with the browser, quitting the
>browser and entering the web page again later generates a new session ID
This can be a confusing issue. CGI::Session automatically recreates a
session given a session id. It generates a new session id when it does
not receive one.
When you create the session object, be careful to tell it whether you
want to create a new id or to retrieve an existing session.
To generate a brand new session for a user, just pass an
undefined value as the second argument to the constructor - new():
$session = new CGI::Session("driver:File", undef,
{Directory=>"/tmp"});
http://search.cpan.org/~sherzodr/CGI-Session-3.95/Session/Tutorial.pm
To recreate an existing session you need to pass the session id to
Session from a cookie or URL parameter. In your case, the session id
needs to come from the cookie. If you're using CGI module you can do
this with one line
$session = new CGI::Session(undef, $cgi, {Directory=>"/tmp"});
Note that the second parameter to the constructor is not undef. This
causes it too look there for a session id to reconstruct a session
from. If it is passed a CGI module object, then it uses that to obtain
the cookie value automatically. Otherwise, you have to get that
yourself from the CGI module. I generally run Session along with the
CGI module and FormBuilder, DBI, HTML Template because they are
generally aware of each other. So I pass the CGI object to Session and
to FormBuilder.
If this is not the problem, then I suggest you are creating what is
called a "session cookie" that lasts only until the browser is closed.
You will need to ensure that the cookie is "persistent" by giving the
cookie an expiration date using the CGI interface. See that on
cookies.
Steve
Lead Developer
www.folkstreams.net
|
Try Searching:
servers, voip, java, networking, microsoft ...
|
|
|
|