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

I have several questions:

First of all, should the following set a cookie correctly:

$cookie = $query->cookie(-name=>'name', -value=>'value', -expires=>'expcode', -path=>'partial_url', -domain=>'.domain.com' -secure=>1); print $query->header(-cookie=>$cookie);
If so, what goes in the 'partial_url' part of it, if not, what should I do?

Next, how would I retrieve the cookie value above?

Finally, is there a way I could test if the script for setting cookies works? Let's say I upload the script and I go to the script, should it put a cookie in my system (Win98)? If so, where do I look for it?(Temporary internet files) If not, why doesn't it do so? Shouldn't it?

Thanks.

Zenon Zabinski | zdog | zdog7@hotmail.com

Replies are listed 'Best First'.
(chromatic) Re: Completely Cookies
by chromatic (Archbishop) on Jul 15, 2000 at 07:52 UTC
    According to the 2nd edition of the O'Reilly CGI book, if you set the path, the browser will only return the cookie for URLs below it.

    If you set it for /secure, /secure/foo.cgi and /secure/bar.cgi will have access to it, but /insecure won't.

    To test cookie setting, I usually tell my browser to warn me about every cookie being set. (They're usually stored in Temporary Internet Files under your profile under Win32, though.)

(jcwren) Re: Completely Cookies
by jcwren (Prior) on Jul 15, 2000 at 08:14 UTC
    Win98 puts cookies in 'C:\windows\Temporary Internet Files'.
    Windows NT 4.0 puts cookies in '%systemroot%\Profiles\[username]\Cookies'.
    Win2K puts cookies in '%systemroot%\Documents and Settings\[username]\Cookies'.
    Windows 3.11 never gets far enough to use cookies, and displays a GPF error <G>.

    Depending on what you use to browse the directory structure, you may or may not see the directories. For instance, in a DOS shell, under NT, the Cookies directory is hidden, unless you provide the '/a' command line switch. I think the same may be true of setting the correct options in 'Windows Explorer', but I never use that, so I can't tell you for sure.

    --Chris

    e-mail jcwren
Re: Completely Cookies
by jjhorner (Hermit) on Jul 16, 2000 at 21:05 UTC

    Look at this node to see a quote from the PerlCD bookshelf about cookies, how to set them, and how to retrieve them.

    Hope this helps.

    J. J. Horner
    Linux, Perl, Apache, Stronghold, Unix
    jhorner@knoxlug.org http://www.knoxlug.org/