in reply to Re^3: cannot Access the sub-routine
in thread cannot Access the sub-routine

If you wish I would like to email to you.

Replies are listed 'Best First'.
Re^5: cannot Access the sub-routine
by Anonymous Monk on Jul 19, 2004 at 18:23 UTC
    The source I just added is
    sub readCookies
    {
    use CGI qw/:standard/;
    if (my $time = cookie('WBSession')) {

    $testVal = "Cookie Exists";

    } else {
    $testVal = "Cookie Does Not Exists";
    }

    return $testVal;
    }
    And I tried adding the below line to the code existing code.
    print "set-cookie: WBSession=$sessionInfo; path=/cgi-bin;\n\n";
    print "set-cookie: TestCookie=$testVal; \n\n";//added
    Whenever I add this I get the set-cookie: TestCookie=$testVal printed on the top of the screen. why is it like this ?

      You see those because something has already finished printing headers to the browser. Your print statements print headers; they must come before all other output.

      Something somewhere else in your program is printing headers. If you want to set cookies, you'll have to print them wherever that something is in your program. It may be a call to header() or something like print "Content-type: text/html\n\n".