From: rkinyon Date: Thu, 9 Mar 2006 19:51:12 +0000 (+0000) Subject: Added MSWin32 checks for is_writable call X-Git-Tag: 0-99_01~63 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9e4f83a0812a6a6656708a9740e8c0920a34acc8;p=dbsrgits%2FDBM-Deep.git Added MSWin32 checks for is_writable call create_tag => write_tag --- diff --git a/lib/DBM/Deep.pm b/lib/DBM/Deep.pm index 524ddcd..8171d60 100644 --- a/lib/DBM/Deep.pm +++ b/lib/DBM/Deep.pm @@ -457,7 +457,7 @@ sub STORE { my $self = shift->_get_self; my ($key, $value) = @_; - unless ( _is_writable( $self->_fh ) ) { + if ( $^O ne 'MSWin32' && !_is_writable( $self->_fh ) ) { $self->_throw_error( 'Cannot write to a readonly filehandle' ); } @@ -527,7 +527,7 @@ sub DELETE { my $self = $_[0]->_get_self; my $key = $_[1]; - unless ( _is_writable( $self->_fh ) ) { + if ( $^O ne 'MSWin32' && !_is_writable( $self->_fh ) ) { $self->_throw_error( 'Cannot write to a readonly filehandle' ); } @@ -605,7 +605,7 @@ sub CLEAR { ## my $self = $_[0]->_get_self; - unless ( _is_writable( $self->_fh ) ) { + if ( $^O ne 'MSWin32' && !_is_writable( $self->_fh ) ) { $self->_throw_error( 'Cannot write to a readonly filehandle' ); } @@ -622,7 +622,7 @@ sub CLEAR { return; } - $self->{engine}->create_tag( + $self->{engine}->write_tag( $self, $self->_base_offset, $self->_type, chr(0)x$self->{engine}{index_size}, ); diff --git a/lib/DBM/Deep/Engine.pm b/lib/DBM/Deep/Engine.pm index 3cd96d5..ecb0833 100644 --- a/lib/DBM/Deep/Engine.pm +++ b/lib/DBM/Deep/Engine.pm @@ -127,7 +127,7 @@ sub setup_fh { $obj, $self->tag_size( $self->{index_size} ), ); - $self->create_tag( + $self->write_tag( $obj, $obj->_base_offset, $obj->_type, chr(0)x$self->{index_size}, ); @@ -221,7 +221,7 @@ sub tag_size { return SIG_SIZE + $self->{data_size} + $size; } -sub create_tag { +sub write_tag { ## # Given offset, signature and content, create tag and write to disk ## @@ -414,19 +414,19 @@ sub write_value { ## my $r = Scalar::Util::reftype($value) || ''; if ( $internal_ref ) { - $self->create_tag( $obj, undef, SIG_INTERNAL,pack($self->{long_pack}, $value->_base_offset) ); + $self->write_tag( $obj, undef, SIG_INTERNAL,pack($self->{long_pack}, $value->_base_offset) ); } elsif ($r eq 'HASH') { - $self->create_tag( $obj, undef, SIG_HASH, chr(0)x$self->{index_size} ); + $self->write_tag( $obj, undef, SIG_HASH, chr(0)x$self->{index_size} ); } elsif ($r eq 'ARRAY') { - $self->create_tag( $obj, undef, SIG_ARRAY, chr(0)x$self->{index_size} ); + $self->write_tag( $obj, undef, SIG_ARRAY, chr(0)x$self->{index_size} ); } elsif (!defined($value)) { - $self->create_tag( $obj, undef, SIG_NULL, '' ); + $self->write_tag( $obj, undef, SIG_NULL, '' ); } else { - $self->create_tag( $obj, undef, SIG_DATA, $value ); + $self->write_tag( $obj, undef, SIG_DATA, $value ); } ## @@ -499,7 +499,7 @@ sub split_index { print( $fh pack($self->{long_pack}, $loc) ); - my $index_tag = $self->create_tag( + my $index_tag = $self->write_tag( $obj, $loc, SIG_INDEX, chr(0)x$self->{index_size}, ); @@ -542,7 +542,7 @@ sub split_index { print( $fh pack($self->{long_pack}, $loc) ); - my $blist_tag = $self->create_tag( + my $blist_tag = $self->write_tag( $obj, $loc, SIG_BLIST, chr(0)x$self->{bucket_list_size}, ); @@ -716,7 +716,7 @@ sub find_bucket_list { print( $fh pack($self->{long_pack}, $loc) ); - $tag = $self->create_tag( + $tag = $self->write_tag( $obj, $loc, SIG_BLIST, chr(0)x$self->{bucket_list_size}, );