From: rkinyon@cpan.org Date: Mon, 9 Jun 2008 21:04:16 +0000 (+0000) Subject: Fix for 30085 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=08164b508aa23d2bc2e4e074973315d5bc6808cf;p=dbsrgits%2FDBM-Deep.git Fix for 30085 git-svn-id: http://svn.ali.as/cpan/trunk/DBM-Deep@3551 88f4d9cd-8a04-0410-9d60-8f63309c3137 --- diff --git a/Build.PL b/Build.PL index fd70d65..48b0979 100644 --- a/Build.PL +++ b/Build.PL @@ -10,7 +10,6 @@ my $build = Module::Build->new( 'Fcntl' => '0.01', 'Scalar::Util' => '1.14', 'Digest::MD5' => '1.00', - 'FileHandle::Fmode' => '0.05', }, build_requires => { 'File::Path' => '0.01', diff --git a/Changes b/Changes index 169c3eb..77936e8 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,18 @@ Revision history for DBM::Deep. +1.0012 Jun 09 15:00:00 2008 EST + - (This version is compatible with 1.0011) + - Fix for RT#30085 (Remove dependency on XS module) + - Thank you very much tachyon-II@Perlmonks!! + - Updated the POD with fixes that were made, but still on the TODO list. + - Bypass for RT#36419 (t/44_upgrade_db.t fails on *BSD) + - We're just going to skip that for now. It's a number-of-processes-open + issue. Best is to do a port to another module to do the heavy lifting. + +1.0011 May 27 15:00:00 2008 EST + - (This version is compatible with 1.0010) + - A test has the wrong plan. + 1.0010 May 27 12:00:00 2008 EST - (This version is compatible with 1.0009) - Fix for RT#35140 (invalid POD links) diff --git a/lib/DBM/Deep.pm b/lib/DBM/Deep.pm index 670f6e0..7c9dadd 100644 --- a/lib/DBM/Deep.pm +++ b/lib/DBM/Deep.pm @@ -5,7 +5,7 @@ use 5.006_000; use strict; use warnings; -our $VERSION = q(1.0010); +our $VERSION = q(1.0012); use Data::Dumper (); use Fcntl qw( :flock ); diff --git a/lib/DBM/Deep.pod b/lib/DBM/Deep.pod index cd9f6f7..50aea5f 100644 --- a/lib/DBM/Deep.pod +++ b/lib/DBM/Deep.pod @@ -870,7 +870,7 @@ immediately, please submit many testcases. =head2 Caching -If a user is willing to assert upon opening the file that this process will be +If a client is willing to assert upon opening the file that this process will be the only consumer of that datafile, then there are a number of caching possibilities that can be taken advantage of. This does, however, mean that DBM::Deep is more vulnerable to losing data due to unflushed changes. It also @@ -885,13 +885,6 @@ substr, the STM capabilities of DBM::Deep could be used within a single-process. I have no idea how I'd specify this, though. Suggestions are welcome. -=head2 Importing using Data::Walker - -Right now, importing is done using C to make a complete copy -in memory, then tying that copy. It would be much better to use -L to walk the data structure instead, particularly in the case -of large datastructures. - =head2 Different contention resolution mechanisms Currently, the only contention resolution mechanism is last-write-wins. This @@ -1007,12 +1000,17 @@ These functions cause every element in the array to move, which can be murder on DBM::Deep, as every element has to be fetched from disk, then stored again in a different location. This will be addressed in a future version. +This has been somewhat addressed so that the cost is constant, regardless of +what is stored at those locations. So, small arrays with huge data structures in +them are faster. But, large arrays are still large. + =head2 Writeonly Files -If you pass in a filehandle to new(), you may have opened it in either a readonly or -writeonly mode. STORE will verify that the filehandle is writable. However, there -doesn't seem to be a good way to determine if a filehandle is readable. And, if the -filehandle isn't readable, it's not clear what will happen. So, don't do that. +If you pass in a filehandle to new(), you may have opened it in either a +readonly or writeonly mode. STORE will verify that the filehandle is writable. +However, there doesn't seem to be a good way to determine if a filehandle is +readable. And, if the filehandle isn't readable, it's not clear what will +happen. So, don't do that. =head2 Assignments Within Transactions diff --git a/lib/DBM/Deep/Array.pm b/lib/DBM/Deep/Array.pm index 395592f..6c83b27 100644 --- a/lib/DBM/Deep/Array.pm +++ b/lib/DBM/Deep/Array.pm @@ -5,7 +5,7 @@ use 5.006_000; use strict; use warnings; -our $VERSION = q(1.0010); +our $VERSION = q(1.0012); # This is to allow DBM::Deep::Array to handle negative indices on # its own. Otherwise, Perl would intercept the call to negative diff --git a/lib/DBM/Deep/Engine.pm b/lib/DBM/Deep/Engine.pm index 05b24dc..5bd76a5 100644 --- a/lib/DBM/Deep/Engine.pm +++ b/lib/DBM/Deep/Engine.pm @@ -5,7 +5,7 @@ use 5.006_000; use strict; use warnings; -our $VERSION = q(1.0010); +our $VERSION = q(1.0012); # Never import symbols into our namespace. We are a class, not a library. # -RobK, 2008-05-27 diff --git a/lib/DBM/Deep/File.pm b/lib/DBM/Deep/File.pm index dc0b002..73c8b0e 100644 --- a/lib/DBM/Deep/File.pm +++ b/lib/DBM/Deep/File.pm @@ -5,10 +5,9 @@ use 5.006_000; use strict; use warnings; -our $VERSION = q(1.0010); +our $VERSION = q(1.0012); use Fcntl qw( :DEFAULT :flock :seek ); -use FileHandle::Fmode (); sub new { my $class = shift; @@ -236,9 +235,17 @@ sub flush { return 1; } +# Taken from http://www.perlmonks.org/?node_id=691054 sub is_writable { my $self = shift; - return FileHandle::Fmode::is_W( $self->{fh} ); + + my $fh = $self->{fh}; + return unless defined $fh; + return unless defined fileno $fh; + local $\ = ''; # just in case + no warnings; # temporarily disable warnings + local $^W; # temporarily disable warnings + return print $fh ''; } sub copy_stats { diff --git a/lib/DBM/Deep/Hash.pm b/lib/DBM/Deep/Hash.pm index fee93c0..4c77e78 100644 --- a/lib/DBM/Deep/Hash.pm +++ b/lib/DBM/Deep/Hash.pm @@ -5,7 +5,7 @@ use 5.006_000; use strict; use warnings; -our $VERSION = q(1.0010); +our $VERSION = q(1.0012); use base 'DBM::Deep'; diff --git a/t/44_upgrade_db.t b/t/44_upgrade_db.t index 53711e6..310456f 100644 --- a/t/44_upgrade_db.t +++ b/t/44_upgrade_db.t @@ -7,6 +7,10 @@ BEGIN { plan skip_all => "Skipping the upgrade_db.pl tests on Win32/cygwin for now." if ( $^O eq 'MSWin32' || $^O eq 'cygwin' ); + plan skip_all => "Skipping the upgrade_db.pl tests on *bsd for now." + if ( $^O =~ /bsd/i ); + + my @failures; eval { use Pod::Usage 1.3; }; push @failures, 'Pod::Usage' if $@; eval { use IO::Scalar; }; push @failures, 'IO::Scalar' if $@; @@ -16,7 +20,7 @@ BEGIN { } } -plan tests => 252; +plan tests => 282; use t::common qw( new_fh ); use File::Spec; @@ -68,7 +72,7 @@ my @output_versions = ( '0.981', '0.982', '0.983', '0.99_01', '0.99_02', '0.99_03', '0.99_04', '1.00', '1.000', '1.0000', '1.0001', '1.0002', - '1.0003', '1.0004', '1.0005', '1.0006', '1.0007', '1.0008', '1.0009', + '1.0003', '1.0004', '1.0005', '1.0006', '1.0007', '1.0008', '1.0009', '1.0010', '1.0011', '1.0012', ); foreach my $input_filename ( @@ -121,7 +125,7 @@ foreach my $input_filename ( die "$output\n" if $output; my $db; - if ( $v =~ /^1\.000[3-9]/ ) { + if ( $v =~ /^1\.001[0-2]/ || $v =~ /^1\.000[3-9]/ ) { push @INC, 'lib'; eval "use DBM::Deep"; $db = DBM::Deep->new( $output_filename ); diff --git a/utils/upgrade_db.pl b/utils/upgrade_db.pl index 12b5029..c25af18 100755 --- a/utils/upgrade_db.pl +++ b/utils/upgrade_db.pl @@ -28,7 +28,7 @@ my %is_dev = ( my %opts = ( man => 0, help => 0, - version => '1.0010', + version => '1.0012', autobless => 1, ); GetOptions( \%opts, @@ -71,7 +71,7 @@ my %db; { my $ver = $opts{version}; - if ( $ver =~ /^1\.0010/) { + if ( $ver =~ /^1\.001[0-2]/) { $ver = 3; } elsif ( $ver =~ /^1\.000[3-9]/) {