Hi,

I want to maintain the session in perl.For that I used CGI::Session module.I wrote 
simple script as follows.I am storing the one variable called "name" in session in 
first perl file(first.pl).Now I am tring to access this variable in Second perl 
page(second.pl).
Now my problem is when I prints name variable in first perl file(first.pl) where I 
stored this variable in Session,it gets printed.but when I tries to access it in 
second page(second.pl) it does not get printed.I gives empty output.
Can somebody help me?

My scripts are:

---------------------------------------------------------------------------first.pl-----------------------------------------------------------------------------------------
# !/usr/bin/perl
use CGI;
use CGI::Session;
my $session = new CGI::Session("driver:File", undef, {Directory=>'/tmp'});
$session->param('name', 'pankaj');
$cgi =new CGI;
print $cgi->redirect('../html/second.pl');

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------second.pl----------------------------------------------------------------------------------------------
# !/usr/bin/perl
print "Content-type:text/html\n\n";
use CGI;
use CGI::Session;
my $session = new CGI::Session("driver:File", undef, {Directory=>'/tmp'});
$myname =$session->param('name');
print "My Name =$myname";
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
These scripts run without any errror but not giving required output.
I have also tried CGI::Session::Simple but same proble with the script.
I am writting these scripts on Linux machine and for Apache Web Server.

Thanks in advance !!!
pankaj.


Reply via email to