[comp.lang.perl] Problem with flock?

lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) (01/12/91)

In article <1991Jan11.103201.26506@ircam.fr> fingerhu@ircam.fr (Michel Fingerhut) writes:
: When flock is called on an already locked file descriptor with operation
: $LOCK_EX | $LOCK_NB (i.e., exclusive lock no block) it returns 0, which is
: contrary to the flock(2) description:
: 
: 	Requesting a lock on an object that is already locked normally
: 	causes the caller to blocked until the lock can be acquired.  If
: 	LOCK_NB is included in operation, the call is not blocked;
: 	instead, the call fails and the error EWOULDBLOCK is returned.
: 
: This works correctly in C programs.
: 
: Any help/suggestions?

As with most Perl functions, Perl returns true for success and false for
failure.  It's a bug that this isn't documented under flock in the man page
for Perl.

Larry