> -----Original Message-----
> From: John Pitchko [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 29, 2002 9:40 AM
> To: [EMAIL PROTECTED]
> Subject: fetch CGI::Cookie Trouble
> 
> 
> Hey guys,
> 
> I am having trouble when accessing cookies we've created. I 
> am using CGI::Cookie in a script to generate the cookie and 
> send it to the browser. This seems to work fine, as the 
> cookie is then saved and I can see it in my local Cookies 
> folder on my computer. However, when using the fetch 
> CGI::Cookie command, we get:
> 
> Can't call method "value" on an undefined value at 
> /appl/webdocs/cgi-bin/verify.cgi line 45.
> 
> We are using the exact code from the manpage and have no idea 
> why this is happening. Any suggestions?

Help us out by posting the offending code.

I assume you're doing something like this:

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

If there is no cookie named 'ID', then $cookies{'ID'} would be
undefined, so $cookies{'ID'}->value would be equivalent to

   undef->value;

which is obviously a problem. You really need to make sure you
received a cookie named ID first by something like:

    %cookies = fetch CGI::Cookie;
    $id = defined($cookies{ID}) && $cookies{ID}->value;

I can't say why you aren't getting the cookie. Make sure everything
is spelled correctly.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to