Persistent session data in CGI applications
Version: 4.38CGI::Session is a Perl module that offers persistent session data in CGI applications.
License: Perl Artistic License
Operating System: Linux
# Object initialization:
$session = new CGI::Session();
$CGISESSID = $session->id();
# Send proper HTTP header with cookies:
# Storing data in the session:
# Flush the data from memory to the storage driver at least before your
# program finishes since auto-flushing can be unreliable.
# Warning: A bug in your logic whereby the DBI handle has gone
# out of scope before flush() is called means flush() won't work
# (when the session is a database session), so don't do that.
# Retrieving data:
my $f_name = $session->param('f_name');
my $l_name = $session->param(-name=>'l_name');
# Clearing a certain session parameter:
# Expire '_is_logged_in' flag after 10 idle minutes:
# Expire the session itself after 1 idle hour:
# Delete the session for good:
$session->flush(); # Recommended practice says use flush() after delete().
CGI-Session is a Perl5 library that provides an easy, reliable and modular session management system across HTTP requests. Persistency is a key feature for such applications as shopping carts, login/authentication routines, and application that need to carry data across HTTP requests. CGI::Session does that and many more.