Fixes for signedness warnings noticed by VMSperlers.
[p5sagit/p5-mst-13.2.git] / ext / Storable / Storable.pm
index 5cd06a0..d2a631c 100644 (file)
@@ -1,4 +1,4 @@
-;# $Id: Storable.pm,v 1.0.1.5 2000/10/26 17:10:18 ram Exp ram $
+;# $Id: Storable.pm,v 1.0.1.5 2000/10/26 17:10:18 ram Exp $
 ;#
 ;#  Copyright (c) 1995-2000, Raphael Manfredi
 ;#  
@@ -6,6 +6,9 @@
 ;#  in the README file that comes with the distribution.
 ;#
 ;# $Log: Storable.pm,v $
+;# Revision 1.0.1.6  2000/11/05 17:20:25  ram
+;# patch6: increased version number
+;#
 ;# Revision 1.0.1.5  2000/10/26 17:10:18  ram
 ;# patch5: documented that store() and retrieve() can return undef
 ;# patch5: added paragraph explaining the auto require for thaw hooks
@@ -35,7 +38,7 @@ package Storable; @ISA = qw(Exporter DynaLoader);
 use AutoLoader;
 use vars qw($forgive_me $VERSION);
 
-$VERSION = '1.005';
+$VERSION = '1.006';
 *AUTOLOAD = \&AutoLoader::AUTOLOAD;            # Grrr...
 
 #
@@ -132,7 +135,10 @@ sub _store {
        open(FILE, ">$file") || logcroak "can't create $file: $!";
        binmode FILE;                           # Archaic systems...
        if ($use_locking) {
-               if ($^O eq 'dos') {
+               require Config; import Config;
+               if (!$Config{'d_flock'} &&
+                   !$Config{'d_fcntl_can_lock'} &&
+                   !$Config{'d_lockf'}) {
                        logcarp "Storable::lock_store: fcntl/flock emulation broken on $^O";
                        return undef;
                }
@@ -252,11 +258,15 @@ sub _retrieve {
        my $self;
        my $da = $@;                                                    # Could be from exception handler
        if ($use_locking) {
-               if ($^O eq 'dos') {
-                       logcarp "Storable::lock_store: fcntl/flock emulation broken on $^O";
+               require Config; import Config;
+               if (!$Config{'d_flock'} &&
+                   !$Config{'d_fcntl_can_lock'} &&
+                   !$Config{'d_lockf'}) {
+                       logcarp "Storable::lock_retrieve: fcntl/flock emulation broken on $^O";
                        return undef;
                }
-               flock(FILE, LOCK_SH) || logcroak "can't get shared lock on $file: $!";
+               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