in reply to Perl + web cookies, not sure why this is failing

What you describe is expected behaviour. On the request where you set the cookie, you cannot also read the cookie. That's just how cookies work.

This is not Perl-specific: you'll see the same result writing CGI scripts in pretty much any language; you'll see the same in PHP, the same in Ruby on Rails.

  • Comment on Re: Perl + web cookies, not sure why this is failing

Replies are listed 'Best First'.
Re^2: Perl + web cookies, not sure why this is failing
by desertrat (Sexton) on Mar 04, 2012 at 21:13 UTC
    Thank you. Gah..I was trying to avoid doing a page reload here, as the main page people will be hitting is kind of slow to start with, and doing it twice over will just make it that much more annoying. Looks like I'll have to do this via some ajax code; more complicated to write.

      You don't need to do any such thing. If your application is setting a cookie, then it doesn't need to be able read it back.

      Imagine I've posted you a letter. I don't need to wait until you write back to find out what I wrote to you. I wrote it. I can remember.