From: rkinyon@cpan.org Date: Tue, 21 Oct 2008 01:28:33 +0000 (+0000) Subject: Fixed a bug in upgrade_db.pl in failing on unrecognized versions X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f709c026313d42f871c079f0b961d14a1bf4d499;p=dbsrgits%2FDBM-Deep.git Fixed a bug in upgrade_db.pl in failing on unrecognized versions git-svn-id: http://svn.ali.as/cpan/trunk/DBM-Deep@4460 88f4d9cd-8a04-0410-9d60-8f63309c3137 --- diff --git a/t/44_upgrade_db.t b/t/44_upgrade_db.t index 4d943d5..b7a3c61 100644 --- a/t/44_upgrade_db.t +++ b/t/44_upgrade_db.t @@ -87,6 +87,7 @@ foreach my $input_filename ( foreach my $v ( @output_versions ) { my (undef, $output_filename) = new_fh(); + my $output = run_prog( $PROG, "-input $input_filename", @@ -94,7 +95,7 @@ foreach my $input_filename ( "-version $v", ); - #warn "Testing $input_filename against $v\n"; + warn "Testing $input_filename against $v\n"; # Clone was removed as a requirement in 1.0006 if ( $output =~ /Can\'t locate Clone\.pm in \@INC/ ) { @@ -125,12 +126,12 @@ foreach my $input_filename ( # Now, read the output file with the right version. ok( !$output, "A successful run produces no output" ); - die "$output\n" if $output; + die "'$input_filename' -> '$v' : $output\n" if $output; my $db; if ( $v =~ /^1\.001[0-4]/ || $v =~ /^1\.000[3-9]/ ) { push @INC, 'lib'; - eval "use DBM::Deep"; + eval "use DBM::Deep $v"; die $@ if $@; $db = DBM::Deep->new( $output_filename ); } elsif ( $v =~ /^1\.000?[0-2]?/ ) { diff --git a/utils/upgrade_db.pl b/utils/upgrade_db.pl index 91003c3..90e8873 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.0013', + version => '1.0014', autobless => 1, ); GetOptions( \%opts, @@ -71,16 +71,16 @@ my %db; { my $ver = $opts{version}; - if ( $ver =~ /^1\.001[0-3]/) { + if ( $ver =~ /^1\.001[0-4]/ ) { $ver = 3; } - elsif ( $ver =~ /^1\.000[3-9]/) { + elsif ( $ver =~ /^1\.000[3-9]/ ) { $ver = 3; } - elsif ( $ver =~ /^1\.000?[0-2]?/) { + elsif ( $ver eq '1.00' || $ver eq '1.000' || $ver =~ /^1\.000[0-2]/ ) { $ver = 2; } - elsif ( $ver =~ /^0\.99/) { + elsif ( $ver =~ /^0\.99/ ) { $ver = 1; } elsif ( $ver =~ /^0\.9[1-8]/ ) {