in reply to File::DumbLock

Please don't use this code.

Please don't give this code your ++ votes.

This code has obvious holes. It is neither functional, nor necessary.

There are ways of executing "atomic" test-and-set operations in every operating system, and this code does not use any of them. This code has windows of vulnerability. It's not a matter of whether or not you'll get burned, but when.

Do not use this code.

-- Randal L. Schwartz, Perl hacker

UPDATE: Hey, to the losers who downvoted this node, next time you get broken in or you can't get your code to work, just remember what you think of expert advice. {sigh} If you don't want me watching your backside, I won't waste my time. I just wish you would have enough guts to tell me to my e-face. Not just -- this node.

And a few people were kind enough to ask me to post references to how it should be done. Most of the first dozen hits I examined by a simple google for "perl lock" were very well written and don't suffer the problems of the code above. I don't think I should need to add instructions about google-ing to every node I write. {sigh}