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

Hi,

I was wondering if there is any difference between setting a cookie with the CGI.pm module or just using:

print "Set-Cookie: cookiename=cookievalue; path=/\n";

I would really appreciate knowing if there is any flaw with the "Set-Cookie" header above, which would prevent the cookie from being set under some browser configurations.

Thanks,
Ralph

  • Comment on Setting cookies with CGI.pm vs. Set-Cookie

Replies are listed 'Best First'.
Re: Setting cookies with CGI.pm vs. Set-Cookie
by ikegami (Patriarch) on Jan 27, 2006 at 18:00 UTC
    Set-Cookie was replaced with safer Set-Cookie2 6.5 years ago. I'm not sure why it's safer. Unforunately, CGI uses Set-Cookie.
Re: Setting cookies with CGI.pm vs. Set-Cookie
by eric256 (Parson) on Jan 27, 2006 at 18:56 UTC

    CGI.pm handles the printing of the hearder for you. It is a very nice tool to let do that grunt work for you so you don't have to remember how to format your headers.


    ___________
    Eric Hodges