added ignore_empty_subfields [0.24_1]
[Biblio-Isis] / scripts / dump_isisdb.pl
index 19e46c2..fe7c98c 100755 (executable)
@@ -1,28 +1,38 @@
 #!/usr/bin/perl -w
 
 use strict;
-#use blib;
+use blib;
 
 use Biblio::Isis;
 use Getopt::Std;
-use Data::Dumper;
+
+BEGIN {
+       eval "use Data::Dump";
+
+       if (! $@) {
+               *Dumper = *Data::Dump::dump;
+       } else {
+               use Data::Dumper;
+       }
+}
 
 my %opt;
-getopts('dn:', \%opt);
+getopts('do:l:', \%opt);
 
-my $isisdb = shift @ARGV || die "usage: $0 [-n number] [-d] /path/to/isis/BIBL\n";
+my $isisdb = shift @ARGV || die "usage: $0 [-o offset] [-l limit] [-d] /path/to/isis/BIBL\n";
 
 my $isis = Biblio::Isis->new (
        isisdb => $isisdb,
-       debug => $opt{'d'},
+       debug => $opt{'d'} ? 2 : 0,
        include_deleted => 1,
 #      read_fdt => 1,
 );
 
 print "rows: ",$isis->count,"\n\n";
 
-my $min = 1;
+my $min = $opt{o} || 1;
 my $max = $isis->count;
+$max = ( $min + $opt{l} - 1 ) if ($opt{l});
 
 for my $mfn ($min .. $max) {
        print STDERR Dumper($isis->to_hash($mfn)),"\n" if ($opt{'d'});