Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: Problem setting cookie using CGI::Cookie

by chromatic (Archbishop)
on Jun 04, 2003 at 23:35 UTC ( [id://263183] : note . print w/replies, xml ) Need Help??

in reply to Problem setting cookie using CGI::Cookie

&url prints a header

You only get to print the header once per invocation. You have to stick the cookie in there before you print it. I'm not having much luck making sense out of your variable names or comparisons, so I can't say for sure that this is your problem, but checking the request method sure looks like it'll print the header too eary to set a cookie.

By the way, calling a sub with the &url syntax is not only ugly, it does things implicitly that you may not want. See perlsub for more. I much prefer url() and recommend that you consider it.

Replies are listed 'Best First'.
Re: Re: Problem setting cookie using CGI::Cookie
by kutsu (Priest) on Jun 04, 2003 at 23:48 UTC

    Oops...I said that wrong, the &url is used to load my css. Also, I prefer url() as well, I just used & because I wasn't originally planning on using cookies (so &url was Location: ...), until I found out the boss doesn't want to use .htaccess.

    Update:Took out CGI::Cookie, forgot why I had it there in the first place, and my path is correct (I just don't want to post it because of security)

    Thanks for pointing that out though, I went ahead and changed that, didn't help my problem though.

    "Pain is weakness leaving the body, I find myself in pain everyday" -me