rjsaulakh has asked for the wisdom of the Perl Monks concerning the following question:
i have tried to create a module which when used stores session variables
please let me know if i am wrong some where in my coding
package raman; use strict; use CGI::Carp qw(fatalsToBrowser); #die "Bad error here"; use CGI; use CGI::Cookie; use CGI::Session; my $cgi = new CGI; use lib "/usr/random/directory"; our @ISA = qw(Exporter); my $session_dir = "C:\\raman"; use constant SESSION_COOKIE => "MY_SITE_SIDE"; my $sid = $cgi->cookie(SESSION_COOKIE) || $cgi->param("sid") || undef; my $session = new CGI::Session("driver:File", $cgi, { + Directory=>$session_dir } ) #incase of any error the session close giving an error or die $CGI::Session::errstr; my $cookie = $cgi->param(-name => SESSION_COOKIE, -value => $session->id, #sessiion expires after 3 hours -expires=>"+3h"); $cgi->header(-cookie=>$cookie); #print $cgi->header; #print "Your session id is ", $session->id(); # A cookie is being created which is then being send to the user brows +er #$session->param('username', 'raman'); #$session->save_param($cgi, ["username", "password"]); #print $session->param('username'); #prints raman # this line saves all the available/accessible CGI params my $x= $session->save_param($cgi); 1;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: session module
by Joost (Canon) on Jun 02, 2005 at 12:42 UTC | |
by rjsaulakh (Beadle) on Jun 02, 2005 at 16:30 UTC | |
by Joost (Canon) on Jun 02, 2005 at 17:25 UTC | |
Re: session module
by bart (Canon) on Jun 02, 2005 at 12:45 UTC | |
Re: session module
by PodMaster (Abbot) on Jun 02, 2005 at 12:40 UTC | |
| |
Re: session module
by jpeg (Chaplain) on Jun 02, 2005 at 12:52 UTC | |
by Forsaken (Friar) on Jun 02, 2005 at 13:18 UTC | |
Re: session module
by perl_devel (Friar) on Jun 02, 2005 at 13:19 UTC | |
Re: session module
by thcsoft (Monk) on Jun 02, 2005 at 13:14 UTC |
Back to
Seekers of Perl Wisdom