open(FILE, ">$file") || logcroak "can't create $file: $!";
binmode FILE; # Archaic systems...
if ($use_locking) {
+ if ($^O eq 'dos') {
+ require Carp;
+ Carp::carp "Storable::lock_store: fcntl/flock emulation broken on $^O\n";
+ return undef;
+ }
flock(FILE, LOCK_EX) ||
logcroak "can't get exclusive lock on $file: $!";
truncate FILE, 0;
my $self;
my $da = $@; # Could be from exception handler
if ($use_locking) {
- flock(FILE, LOCK_SH) || logcroak "can't get shared lock on $file: $!";
+ if ($^O eq 'dos') {
+ require Carp;
+ Carp::carp "Storable::lock_retrieve: fcntl/flock emulation broken on $^O\n";
+ return undef;
+ }
+ flock(FILE, LOCK_SH) ||
+ logcroak "can't get shared lock on $file: $!";
# Unlocking will happen when FILE is closed
}
eval { $self = pretrieve(*FILE) }; # Call C routine
sub BEGIN {
chdir('t') if -d 't';
- @INC = '.';
+ @INC = '.';
push @INC, '../lib';
require Config; import Config;
if ($Config{'extensions'} !~ /\bStorable\b/) {
print "1..0 # Skip: no flock or flock emulation on this platform\n";
exit 0;
}
+ if ($Config{'osname'} eq 'dos') {
+ print "1..0 # Skip: fcntl/flock emulation broken on this platform\n";
+ exit 0;
+ }
require 'lib/st-dump.pl';
}