On Wed, 9 Jan 2002 19:39:02 -0500, Chris Nandor wrote:

>At 17:47 -0600 2002.01.09, George Thomas wrote:
>>"flock" is not available in MacPerl.
>
>True.
>
>flock() is rarely necessary in MacPerl.  Mac OS won't allow more than one
>app to write to a file at one time, usually, anyway.

Instead, a second open() with write access, will fail. Something to be
very wary about.

I just wish that flock() wouldn't case a fatal error on these platforms
(Mac/Win). Now you have to work your way around it. Something like:

        use Fcntl ':flock';
        use constant HASFLOCK => eval { flock STDOUT, LOCK_UN; 1 } || 0;
        print HASFLOCK;

and use:

        flock FILE, LOCK_EX if HASFLOCK;

-- 
        Bart.

Reply via email to