http://www.perlmonks.org?node_id=590721


in reply to Re^2: Ensuring only one copy of a perl script is running at a time
in thread Ensuring only one copy of a perl script is running at a time

This node falls below the community's threshold of quality. You may see it by logging in.
  • Comment on Re^3: Ensuring only one copy of a perl script is running at a time

Replies are listed 'Best First'.
Re^4: Ensuring only one copy of a perl script is running at a time
by polettix (Vicar) on Dec 24, 2006 at 02:49 UTC
    Citing tye:
    It sounds like it is time for you to update your computer science knowledge by learning about race conditions.
    When a question/issue raises up, it's likely that more than one person will try to answer. This is not even a shared CPU environment: it's true concurrency. But humans tend to have personal ways of doing stuff: there's the verbose one, the one that uses only two fingers to write on the keyboard, the one that answers to the telephone... and in the end you have that many answers overlap each other, even if their times are quite different. It's like a race... a race condition :)

    In this case, I'd also enhance your answer to the OP giving enough evidence of the need to use flock (and marking such a modification clearly, in order to keep the following answers "meaningful"): the fact that your personal script used flock was not entirely evident :)

    Flavio
    perl -ple'$_=reverse' <<<ti.xittelop@oivalf

    Don't fool yourself.
Re^4: Ensuring only one copy of a perl script is running at a time
by ikegami (Patriarch) on Dec 19, 2006 at 17:59 UTC

    Suggest you read my update posted 15 minutes *before* your reply.

    (tye's post wasn't there when I started replying, so your reply to his post wasn't either!)