in reply to Re: Cookie->fetch problem
in thread Cookie->fetch problem

Forgot to tale it out. Not so easy. Now I can't log out. Ugh!! Cleared all the cookies and shut down. Still logged in Obviously the logged in flag is still st. Tomorrow another day.

Replies are listed 'Best First'.
Re^3: Cookie->fetch problem
by tultalk (Monk) on Mar 10, 2017 at 18:38 UTC

    Hi: Round and round. Just can't recover a $sid from a cookie.

    Tried count on the cookies and it returned 0 Still struggling with this hole in my program. There are three cookies associated with my site.

    Fri Mar 10 12:31:32 2017 manage_users.cgi: keycount: '0' at /home/jalamior/www/httpsdocs/cgi-bin/lib/perl/manageusers.pm line 681.

    my %cookies = CGI::Cookie->fetch; my $count = keys %cookies; warn("keycount: '$count'"); while(my($key, $value) = each %cookies){ Dumper \$key; Dumper \$value; if($key eq $sessionname){ $sid = $value; } }

      they expired?

      if firefox
      tools->options->privacy->show cookies.
      look for your domain(s), press + to expand, look for cookie names.

      if you are running a separate test server, make sure you are looking at the right domain

        I have checked the cookies. They are in the correct domain.

        I will keep struggling with this. In the meanwhile I just the sid from the cookie into the $sid variable in the subroutine so I can keep working. V hange to 0 to get logged out.

        Best regards

      Well,

      I think its time to show a complete program

      Or get some hands on help

      Some problems cannot be debugged piecemeal , conceptual holes don't allow it

        Hi:

        The problem is in the tiny isolated subroutine below. This code is from cookie.pm

        sub GetUserSessionCookie { warn("Entered GetUserSessionCookie Sessionname: '$sessionname'"); + # fetch existing cookies from cookie.pm CGI::Cookie - Interface to + HTTP Cookies my %cookies = CGI::Cookie->fetch; my $id = $cookies{'ID'}->value; my $sid = $id; warn($sid); $sid = 0; #for testing the rest of program. If I put in valid SI +D from #cookie recognizes user as logged on. return $sid; }

        The error returned:

        Can't call method "value" on an undefined value at /home/jalamior/www/httpsdocs/cgi-bin/lib/perl/manageusers.pm line 674.
        

        Is that error because there is no cookie->id string recovered by the call or a problem with the call itself?

        When I log in to https://www.jala-mi.org/httpsdocs/index.html

        Firebug cookies shows

        CGISESSID=16c11ce44ef8ffcfe6a5f0d74e4e0860; expires=Sun, 19 Mar 2017 00:47:22 GMT; path=/cgi-bin; domain=.www.jala-mi.org; Secure

        Opening the edit dialog under Firebug shows cookies.edit.expire.label as the date/time the cookie was created and when I click Ok, the cookie disappears.

        Log in again and new cookie with new date/time of creation in Firebug.

        Don't know what this is.