3 # Check flock() feature
5 # This isn't a real test; it just checks to make sure we can call the method.
6 # It doesn't even check to make sure that the default behavior
7 # (LOCK_EX) is occurring. This is because I don't know how to write a good
8 # portable test for flocking. I checked the Perl core distribution,
9 # and found that Perl doesn't test flock either!
12 eval { flock STDOUT, 0 };
13 if ($@ && $@ =~ /unimplemented/) {
19 use Fcntl ':flock'; # This works at least back to 5.004_04
21 my $file = "tf$$.txt";
29 print "ok $N\n"; $N++;
31 # 2-4 Who the heck knows?
32 open F, "> $file" or die $!;
34 $o = tie @a, 'Tie::File', $file, recsep => 'blah';
35 print $o ? "ok $N\n" : "not ok $N\n";
38 print $o->flock() ? "ok $N\n" : "not ok $N\n";
41 print $o->flock(LOCK_UN) ? "ok $N\n" : "not ok $N\n";