CGI query and FORM

P

Praki

Hi All,

I m creating the session in the Perl. all the functions are done in a
single file. the operations are performed by the command line
arguments.

for managing the session i m using the CGI. but when i create a CGI
object then all the Input from both POST and GET methods are parsed by
it. i m not able to get the varbale values using FORM. My work is the
enhancemet work so if i change all the FORM varible to CGI query then
its huge task. Is there any way to get the session info from the FORM
Variable...

This comes first of all the lines in my cgi file. so it parse all the
POST and GET methods..
i m not able to the values from FORM varible..

$query = new CGI;
$sid = $query->cookie('CGISESSID') || $query->param('CGISESSID') ||
undef;

after the abouve line
if ($FORM{'lab'} eq "pager") {

plz help me in getting this problem. Is there any way to get session
info from the FORM variable..

Thanks,
Prakash.
 
B

Ben Morrow

Quoth Praki said:
I m creating the session in the Perl. all the functions are done in a
single file. the operations are performed by the command line
arguments.

for managing the session i m using the CGI. but when i create a CGI
object then all the Input from both POST and GET methods are parsed by
it.

Yes, that's how CGI.pm works.
i m not able to the values from FORM varible..

If you're expecting a session id in a cookie, and %FORM contains GET and
POST parameters, then it won't be in there.
$query = new CGI;
$sid = $query->cookie('CGISESSID') || $query->param('CGISESSID') ||
undef;

This final || undef is unnecessary.
after the abouve line
if ($FORM{'lab'} eq "pager") {

You haven't told us how the %FORM variable is created. Chances are
whatever code you are using is buggy and should be replaced, but I
expect you know that.

If you just want to get cookies, without using the rest of CGI.pm, you
can use CGI::Cookie; something like

use CGI::Cookie;

my %COOKIE = CGI::Cookie->fetch;

my $sid = $COOKIE{CGISESSID} || $FORM{CGISESSID};

Ben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top