in reply to Testing if your code successfully flocked

Works for me in FreeBSD and Windows:

use strict; use warnings; use Fcntl ':flock'; open my $fh1, '>>', 'moo' or die "Cannot open moo for appending (1): $!\n"; print(flock($fh1, LOCK_EX | LOCK_NB) ? 1 :0, "\n"); open my $fh2, '>>', 'moo' or die "Cannot open moo for appending (2): $!\n"; print(flock($fh2, LOCK_EX | LOCK_NB) ? 1 :0, "\n");
1 0

Replies are listed 'Best First'.
Re^2: Testing if your code successfully flocked
by dragonchild (Archbishop) on Apr 26, 2005 at 15:07 UTC
    On Solaris, I get:
    $ perl a 1 1
    I think Joost is right, which sucks rocks. *sighs*

    The Perfect is the Enemy of the Good.