NAME
CGI::okSession - Perl extension for CGI Sessions.
SYNOPSIS
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
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
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
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
Nothing yet.
AUTHOR
O. A. Kobyakovskiy, <ok@dinos.net>
COPYRIGHT AND LICENSE
Copyright 2003 by O. A. Kobyakovskiy
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.