CGI query and FORM

Discussion in 'Perl Misc' started by Praki, Dec 13, 2007.

  1. Praki

    Praki Guest

    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.
     
    Praki, Dec 13, 2007
    #1
    1. Advertising

  2. Praki

    Ben Morrow Guest

    Quoth Praki <>:
    >
    > 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
     
    Ben Morrow, Dec 13, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. YesBalala
    Replies:
    1
    Views:
    511
    YesBalala
    Feb 13, 2004
  2. Replies:
    0
    Views:
    190
  3. Stefan Fischer
    Replies:
    2
    Views:
    297
    Stefan Fischer
    Feb 23, 2010
  4. roadrunner
    Replies:
    1
    Views:
    243
    Gunnar Hjalmarsson
    Feb 8, 2006
  5. TPK
    Replies:
    1
    Views:
    323
    Tim Slattery
    Aug 27, 2010
Loading...

Share This Page