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

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.

Replies are listed 'Best First'.
Re^6: Cookie->fetch problem
by huck (Prior) on Mar 12, 2017 at 01:42 UTC

    There is no cookie named ID, i doubt there is even a cookie named CRESSIDA CGISESSID in there.

    Did you ever read Re^9: Cookie->fetch problem? pay attention to the part after "but i just figured out your problem"

    Edited to add:

    your test should probably look like this

    my $id=0; if ($cookies{'CGISESSID'}) { $id = $cookies{'CGISESSID'}->value; }
    but with the path that is set on that cookie you showed no cookies will be returned if you go to https://www.jala-mi.org/httpsdocs/index.html

      There is no cookie named ID, i doubt there is even a cookie named CRESSIDA CGISESSID in there.

      Copy and paste: Ugh

      Hi:

      If I open the file http://www.jala-mi.org/httpsdocs/index.html I see the cookie.

      If I open www.jala-mi.org I don't see the cookie.

      If I open https://www.jala-mi.org/ I don't see the cookie

      If I open https://www.jala-mi.org/httpsdocs/index.html I see the cookie

      This is after I again changed path path=/httpsdocs/cgi-bin; domain=.www.jala-mi.org; Secure

      None of these executions from the directory where the cookie was showing produced a $sid from the cookie in the sub routine using code suggested

      As for posting code, I have repeatedly seen posters admonished for posting too much code.

      I have not seen anyplace to post images/code.

        Hi: Changed path to / and cookie now shows everywhere

        Still is not detected in sub Problem has got to be isolated to this block of code.

        sub GetUserSessionCookie { warn("Entered GetUserSessionCookie Sessionname: '$sessionname'"); + my $sid = 0; my %cookies; my $id=0; if ($cookies{'CGISESSID'}) { $id = $cookies{'CGISESSID'}->value; $sid = $id; } warn($sid); # $sid = 0; #for testing the rest of program. If I put in valid S +ID from #cookie recognizes user as logged on. return $sid; }