Gossamer Forum
Home : General : Perl Programming :

cookie problem

Quote Reply
cookie problem
hey im new to perl and i'm trying to set a cookie on one page and retrieve it in another. he problem is that i get an error. "Can't call method "value" on an undefined value at...".

# set cookie
$cookie = $query->cookie(-name=>'session_id', -value=>"m$member_id\s$count", -expires=>'+1h', -secure=>1);

# fetch existing cookies
%cookies = fetch CGI::Cookie;
$session_cookie = $cookies{'session_id'}->value;

obviously im doing it wrong, can anyone tell me how to do it?
thanks Pedge
Quote Reply
Re: [pedge] cookie problem In reply to
my $value = $query->cookie('session_id');

...that is assuming $query is a CGI object.

Last edited by:

Paul: Dec 2, 2002, 7:32 AM
Quote Reply
Re: [Paul] cookie problem In reply to
but how do i get the value of that cookie?
Quote Reply
Re: [pedge] cookie problem In reply to
I just showed you.