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


in reply to Flock Subroutine

Thus spoke the mt2k:
Using a simple flock FILEHANDLE, LOCK_EX; won't always succeed in locking a file.
Hmm. I don't know of a time that wouldn't either succeed or fail. Maybe you're thinking of or'ing it with LOCK_NB, in which case your code makes sense. But not as it is.

And next, what the heck is this?

sleep .15;
That's a sleep 0, since sleep() doesn't take a fractional number unless you've called in the right overloading module.

Great idea. Bad code. (And I'll probably get flamed for this post again. So be it.)

-- Randal L. Schwartz, Perl hacker