});
unless ( $value_sector ) {
+ # On Win32, we have to release the shared lock and acquire
+ # an exclusive lock in order to do any writing. We cannot
+ # just upgrade the shared lock to an exclusive lock because
+ # ::File::lock() doesn't let us (yet). -RobK, 2007-11-15
+ $self->storage->unlock; $self->storage->lock;
$value_sector = DBM::Deep::Engine::Sector::Null->new({
engine => $self,
data => undef,
$return .= $/;
}
+eval{
SECTOR:
while ( $spot < $self->storage->{end} ) {
# Read each sector in order.
$spot += $sector->size;
}
}
+}; if ( $@ ) {
+ return $return, $@;
+}
return $return;
}
);
my ($loc, $staleness) = unpack( $StP{$e->byte_size} . ' ' . $StP{$STALE_SIZE}, $buffer );
+ # XXX Merge the two if-clauses below
+
if ( $args->{trans_id} ) {
# We have found an entry that is old, so get rid of it
if ( $staleness != (my $s = $e->get_txn_staleness_counter( $args->{trans_id} ) ) ) {
idx => $args->{idx},
});
}
+
return $loc <= 1 ? 0 : $loc;
}
seek( $fh, $loc + $self->{file_offset}, SEEK_SET );
}
- print( $fh @_ );
+ print( $fh @_ ) or die "Internal Error (print_at): $!\n";
return 1;
}
if (!defined($self->{fh})) { return; }
+ #XXX This needs to allow for upgrading a shared lock to an
+ # exclusive lock. q.v. the comment in read_value when
+ # autovivifying. -RobK, 2007-11-15
if ($self->{locking}) {
if (!$self->{locked}) {
flock($self->{fh}, $type);
use_ok( 'DBM::Deep' );
my ($fh, $filename) = new_fh();
-my $db = DBM::Deep->new( $filename );
+my $db = DBM::Deep->new(
+ file => $filename,
+ fh => $fh,
+);
##
# put/get key