in reply to Re: File::lockf and the lock() return value
in thread File::lockf and the lock() return value

Three points and clarifications.

The first is that it is often impossible to use flock due to OS or filesystem limitations. For instance in Linux you cannot use it over NFS.

The second is that if you want to turn errno into a string message, the simplest way to do it is to assign it to $! and then use $! as a string. You can demonstrate this with:

sub errno_to_str { $! = shift; return "$!"; }
The third point is that what this conversion will give for a particular number is highly OS dependent. While 9 gives you "Bad file descriptor", it would be highly unwise to assume that it does the same on someone else's machines.

Replies are listed 'Best First'.
Re: Re (tilly) 2: File::lockf and the lock() return value
by count0 (Friar) on Jan 14, 2002 at 19:47 UTC
    ++, thanks tilly! =)

    The $! = $returned_status is a great trick. I've never used $! like that.

    And thanks for clearing up those other two points.