1 # NOTE: Derived from blib/lib/Storable.pm.
2 # Changes made here will be lost when autosplit is run again.
6 #line 239 "blib/lib/Storable.pm (autosplit into blib/lib/auto/Storable/_store.al)"
7 # Internal store to file routine
11 my ($file, $use_locking) = @_;
12 logcroak "not a reference" unless ref($self);
13 logcroak "wrong argument number" unless @_ == 2; # No @foo in arglist
16 open(FILE, ">>$file") || logcroak "can't write into $file: $!";
18 logcarp "Storable::lock_store: fcntl/flock emulation broken on $^O";
21 flock(FILE, LOCK_EX) ||
22 logcroak "can't get exclusive lock on $file: $!";
24 # Unlocking will happen when FILE is closed
26 open(FILE, ">$file") || logcroak "can't create $file: $!";
28 binmode FILE; # Archaic systems...
29 my $da = $@; # Don't mess if called from exception handler
31 # Call C routine nstore or pstore, depending on network order
32 eval { $ret = &$xsptr(*FILE, $self) };
33 close(FILE) or $ret = undef;
34 unlink($file) or warn "Can't unlink $file: $!\n" if $@ || !defined $ret;
35 logcroak $@ if $@ =~ s/\.?\n$/,/;
37 return $ret ? $ret : undef;
40 # end of Storable::_store