The second click could be calling the CGI script again within the limits of the gettimeofday() function. While you could improve this by increasing the granularity of the function, this would remain unscalable, you should add a random element to $v which would allow the session token to be unique, and also from a security perspective to make the session token less predictable.

CGI::Session may offer what you require, or Apache::Session::Generate::ModUniqueId

Update:Good observation by ww. In my haste I missed the presence of Time::HiRes.

Could you retry with verbose logging of the uniquid() and check_reload() functions? (This may of course prevent a race condition from occuring, or it may demonstrate the issue,)

The fact that you've tried adding a random element to $v without resolution troubles my understanding :(


In reply to Re: (CGI) Prevent a reload from resubmitting a form by Utilitarian
in thread (CGI) Prevent a reload from resubmitting a form by fmk

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.