CGI::okSession - Perl extension for CGI Sessions.


CGI-okSession documentation  | view source Contained in the CGI-okSession distribution.

Index


NAME

Top

CGI::okSession - Perl extension for CGI Sessions.

SYNOPSIS

Top

  use CGI qw/:standard/;
  use CGI::okSession;
  my $AppName = 'MyApplication';
  my $SessionID = 'MyAppSessionID';
  my $timeout = 15*60 # 15 minutes session life time
  my $Session = new CGI::okSession(
	dir=>'/tmp',
	id=>cookie($SessionID),
	app=>$AppName
	);
  $Session->{registred} = 1;
  $Session->{client}->{Email} = 'some@email.com';
  $Session->{client}->{Name} = 'John Smith';
  my $cookie = cookie(
	-name=>$SessionID,
	-value=>$Session->get_ID,
	-expires=>$Session->expires_www
	);
  print header(-cookie=>$cookie);

DESCRIPTION

Top

This package was created to have an easy and enough sessions tools for CGI scripts. Sessions data are saved in the file. It does not work with DBs yet.

PACKAGE METHODS

Top

new

 Creates Session object.

 Recevived parameters are:
 dir - directory where session data will be saved (must
     exist).
       Default: '/tmp'.
 timout - session life time in seconds.
       Default: 30*60
 app - application name. Application data has the list
     of sessions and an expiration time for each of
     sessions. (you can have different application
     names).
       Default: 'default'
 id - session ID. Session will be created if it does not
     exists. If this parameter is not defined then it
     will be generated. It's possible to get the session
     ID by method get_ID().

OBJECT METHODS

Top

expires

 Returns expiration time of session in seconds.

expires_www

 Returns expiration time of session in HTTP format.

get_ID

 Returns ID of Session.




EXPORT

None by default.

SEE ALSO

Top

Nothing yet.

AUTHOR

Top

O. A. Kobyakovskiy, <ok@dinos.net>

COPYRIGHT AND LICENSE

Top


CGI-okSession documentation  | view source Contained in the CGI-okSession distribution.