Subject: | file locking in externally loaded modules not working? |
I wanted to test the following sequence using File::Util, which
automatically locks files for you. If you put the same code into a
single Perl script, the file locking works as expected. In a
Devel::REPL session, it seems as if the file locking performed in
File::Util doesn't work at all. Is this to be expected?
For example, this code would fail in a Perl script, but does not fail
in a Devel::REPL session.
use strict;
use warnings;
use File::Util;
my $f = File::Util->new();
my $fn = '/tmp/foo';
my $fh = File::Util->open_handle( file => $fn, mode => 'write' );
# all OK so far, until the next line which SHOULD cause a fatal error:
my $fh2 = File::Util->open_handle( file => $fn, mode => 'write' );
# ^^^ the above should fail because $fn is already opened and locked ^^^