Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | # NOTE: Derived from ../../lib/Storable.pm. |
2 | # Changes made here will be lost when autosplit is run again. | |
3 | # See AutoSplit.pm. | |
4 | package Storable; | |
5 | ||
6 | #line 315 "../../lib/Storable.pm (autosplit into ../../lib/auto/Storable/_retrieve.al)" | |
7 | # Internal retrieve routine | |
8 | sub _retrieve { | |
9 | my ($file, $use_locking) = @_; | |
10 | local *FILE; | |
11 | open(FILE, $file) || logcroak "can't open $file: $!"; | |
12 | binmode FILE; # Archaic systems... | |
13 | my $self; | |
14 | my $da = $@; # Could be from exception handler | |
15 | if ($use_locking) { | |
16 | unless (&CAN_FLOCK) { | |
17 | logcarp "Storable::lock_store: fcntl/flock emulation broken on $^O"; | |
18 | return undef; | |
19 | } | |
20 | flock(FILE, LOCK_SH) || logcroak "can't get shared lock on $file: $!"; | |
21 | # Unlocking will happen when FILE is closed | |
22 | } | |
23 | eval { $self = pretrieve(*FILE) }; # Call C routine | |
24 | close(FILE); | |
25 | logcroak $@ if $@ =~ s/\.?\n$/,/; | |
26 | $@ = $da; | |
27 | return $self; | |
28 | } | |
29 | ||
30 | # end of Storable::_retrieve | |
31 | 1; |