Permalink
Browse files

- Able to dump multiple DB files

  • Loading branch information...
1 parent 0055bf5 commit d912b2ed357be7cd0121ca57ed180caf0515ca0c @steveschnepp steveschnepp committed Apr 15, 2011
Showing with 9 additions and 7 deletions.
  1. +9 −7 contrib/dump_db
View
16 contrib/dump_db
@@ -5,14 +5,16 @@
use strict;
use warnings;
-my $db_file = shift;
-
-my %hash;
use Fcntl; # For O_RDWR, O_CREAT, etc.
use DB_File;
-tie(%hash, 'DB_File', $db_file, O_RDONLY) or die "$!";
-for my $key (sort keys %hash) {
- my $value = $hash{$key};
- print "$key\t$value\n";
+while (my $db_file = shift) {
+ my %hash;
+ tie(%hash, 'DB_File', $db_file, O_RDONLY) or die "$!";
+
+ for my $key (sort keys %hash) {
+ my $value = $hash{$key};
+ print "$key\t$value\n";
+ }
+ untie(%hash);
}

0 comments on commit d912b2e

Please sign in to comment.