Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Ok, I don't know whats up here... I can set cookies fine...
use CGI;
works fine, but:
use CGI::cookie;
does not...
As I said I was able to set a cookie fine, but I cannot fetch the thing... before I was using CGI::cookie, and everything was peachy... but the server has been upgraded, and now I can't use it...
This is what I am trying right now, but it isn't working.
cookie($name); my $cookieinfo = $cookie->{-value};

I've also tried similar configurations of that... including
$cookieinfo->cookie($name)
Also I've tried many different things... I've also gone through alot of Q/A about it... I'm really stumped this time... is it something stupid that I'm not seeing, or am I completly off the trail?!?

Replies are listed 'Best First'.
Re: Fecthing cookies WITHOUT CGI::cookie
by Beatnik (Parson) on Jul 30, 2001 at 02:56 UTC
    A dirty way is to read $ENV{HTTP_COOKIE} which contains the raw cookie data. Check the CGI and CGI::Cookie version to make sure you don't have a buggy version installed.

    Update: As noticed by crazyinsomniac, try using CGI::Cookie instead of CGI::cookie.

    Greetz
    Beatnik
    ... Quidquid perl dictum sit, altum viditur.
Re: Fecthing cookies WITHOUT CGI::cookie
by mitd (Curate) on Jul 30, 2001 at 06:28 UTC
    Cookies can be tricky because dark forces outside of the CGI::Cookie can be at work. You mention that your server got reconfigured, check that it have a proper DNS entry. Are you trying to test from a server behind a firewall??

    Here is a quote right out of CGI:Cookie 1.18

    # IE requires the path and domain to be present for some reason. $path ||= "/"; # however, this breaks networks which use host tables without fully +qualified # names, so we comment it out. # $domain = CGI::virtual_host() unless defined $domain;

    Also try using raw_fetch instead of fetch.

    Another thing you can try is using IP number instead of domain name while testing this should get around any DNS/Host table gotcha's

    Good luck.

    mitd-Made in the Dark
    'My favourite colour appears to be grey.'