CGI::kSession

CGI::kSession is a sessions manager for CGI.
Download

CGI::kSession Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Marcin Krzyzanowski
  • Publisher web site:
  • http://search.cpan.org/~krzak/JFIF-0.11/JFIF.pm

CGI::kSession Tags


CGI::kSession Description

CGI::kSession is a sessions manager for CGI. CGI::kSession is a sessions manager for CGI.This module can be used anywhere you need sessions. As a session management module, it uses files with a configurable lifetime to handle your session data. For those of you familiar with PHP, you will notice that the session syntax is a little bit similar.METHODSThe following public methods are availible:$s = new CGI::kSession();The constructor, this starts the ball rolling. It can take the following hash-style parameters: lifetime - how long the session lasts, in seconds path - the directory where you want to store your session files id - if you want to give the session a non-random name, use this parameter as well$s->start();This creates a session or resumes an old one (could be used in conjunction with something like HTTP::Cookie). This will return '1' if this is a new session, and '0' if it's resuming an old one. If you defined no values in the 'new()' call, then the session will start with a default lifetime of 600 seconds, a path of /var/tmp, and a random string for an id.$s->save_path();Save the session path or, without an argument, return the current session path. Used with an argument, this performs the same thing as the 'path' parameter in the constructor.$s->id();If the session id exists, this will return the current session id - useful if you want to maintain state with a cookie! If you pass a parameter, it acts the same as new( id => 'some_session_name'), i.e., it creates a session with that id.$s->register();This takes a string as an arguement and basically tells the session object this: "Hey, this is a variable I'm thinking about associating with some data down the road. Hang onto it for me, and I'll let you know what I'm going to do with it". Once you register a variable name here, you can use it in 'set()' and 'get()'.$s->is_registered();Check to see if the function is registered. Returns '1' for true, '0' for false.$s->unregister();Tell the session jinn that you no longer want to use this variable, and it can go back in the bottle (the variable, not the jinn... you still want the jinn around until you call 'destroy()').$s->set();This is where you actually define your variables (once you have "reserved" them using 'register()'). This method takes two arguments: the first is the name of the variable that you registerd, and the second is the info you want to store in the variable.$s->get();This method allows you to access the data that you have saved in a session - just pass it the name of the variable that you 'set()'.$s->unset();Calling this method will wipe all the variables stored in your session.$s->destroy();This method deletes the session file, destroys all the evidence, and skips bail.What's New in This Release:· updated the documentation


CGI::kSession Related Software