CGI::okSession - Perl extension for CGI Sessions.
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);
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.
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().
Returns expiration time of session in seconds.
Returns expiration time of session in HTTP format.
Returns ID of Session.
None by default.
Nothing yet.
O. A. Kobyakovskiy, <ok@dinos.net>
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.
To install CGI::okSession, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CGI::okSession
CPAN shell
perl -MCPAN -e shell install CGI::okSession
For more information on module installation, please visit the detailed CPAN module installation guide.