You've got two options. Check out the CGI directory on CPAN. If that
doesn't work then look into coding it yourself. Keep in mind file/record
locking when coding session management code.
Here are some modules (on very quick inspection) look like they implement
what you want:
CGI::Persistent
CGI::SecureState
CGI::Session
CGI::State
If you code it yourself the general idea will be to (a) store the
sessions, (b) how to represent the session as data, (c), retrieve the
session, (d) expire the sessions over time.
(a) store the sessions
Store the data in individual files or in a database. My preference would
be to store it in a Berkeley DB hash ala DBFile/BerkeleyDB. It's a grown
up version of dbm. The key is your session id.
(b)
Either you can just store a string that you parse, _OR_ use something like
Data::Dumper to serialize something like a hash and store *that*.
(c)
This is just like (a) except in reverse. If you stored a string now you
parse it. If you used Data::Dumper you 'eval' the session and viola! a
array, or hash or whatever.
(d)
Run a server side cron job or have your script randomly kick off a
maintenance script. When in a pure ISP environment I've gone with the
randomly kicked script. The script just deleted sessions that hadn't been
updated in a certain amount of time.
Josh
[EMAIL PROTECTED]
Sent by: [EMAIL PROTECTED]
01/16/02 03:49 AM
To: [EMAIL PROTECTED]
cc:
Subject: CGI-Session question...
Hi everyone,
I am new to CGI-perl scripting. I wanted to know how do we implement
session tracking with perl -CGI.
Is there something like a "Session" object (like in ASP or Java) where we
can put some variables so that we can access them in later pages?
I tried to read the CGI.pm but coul'd understand much...
Will we have to create anew file for each customer who logs in??
Can anyone help me out?
Thanks,
Sachin
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activeperl
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activeperl