http://www.perlmonks.org?node_id=933953


in reply to A flock question

Disable warnings in the eval

#!/usr/bin/perl -w use strict; use warnings; use 5.010; use Fcntl qw/ O_WRONLY O_CREAT LOCK_EX LOCK_NB /; my $result = sysopen my $handle, "abc", O_WRONLY | O_CREAT; close $handle; eval { no warnings; $result = flock $handle, LOCK_EX | LOCK_NB }; if ($@) { say "------$@------"; } say "Done: ", $result ? "Success" : "Failed";

Good Day,
    Dean

Replies are listed 'Best First'.
Re^2: A flock question
by ikegami (Patriarch) on Oct 26, 2011 at 18:19 UTC
    no warnings 'closed';
    would be more appropriate.