I have a perl cgi-bin process that creates a cookie and puts the user in a queue position associated with a mysql database. I reload the page every 45 seconds and that updates their queue position and cookie. The reason why the cookie is update is, because we set it to expire +1m, so if they leave the page their cookie expires, or if they close the browser it expires, but as long as they let the reload happen they will have their cookie updated to not expire for another minute. Onces they reach 1 on the queue, I expire their cookie (I set the expires field to -1y) and delete their session id and remove the Mysql record and redirect the users to a login page along with the cookie expire change.

Here is the strange part the session id deletes fine, Mysql deletes fine, but the cookie is still there for maybe two more minutes before it gets expired. I thought sending the cookie the past years time would immediatley expire the cookie when sent to the browser header.

What I'm I doing wrong. I'm using CGI::COOKIE. Code below for expiring cookie

my $cookieHandle = $cgi->cookie(-name=>$PHQConf{COOKIE_NAME}, -value=> +$sessionObj->id, -expires=>'-1y'); print $cgi->redirect(-uri=>$target, -cookie=>$cookieHandle);

20030329 Edit by Corion : Added formatting


In reply to cookie expire question by koryw

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.