X-Git-Url: http://git.rot13.org/?p=Biblio-Isis;a=blobdiff_plain;f=scripts%2Fdump_isisdb.pl;h=fe7c98cec1c05c508d5807f531f5299b460838f5;hp=057cd292c393a562b1995771435b8259d2c3eebc;hb=98df52084ab3942eb11c8db3d977330263faa64a;hpb=07932c16ad44896d07f77d3e20b9df7dac7bc0ac diff --git a/scripts/dump_isisdb.pl b/scripts/dump_isisdb.pl index 057cd29..fe7c98c 100755 --- a/scripts/dump_isisdb.pl +++ b/scripts/dump_isisdb.pl @@ -4,22 +4,38 @@ use strict; use blib; use Biblio::Isis; -use Data::Dumper; +use Getopt::Std; -my $isisdb = shift @ARGV || '/data/isis_data/ps/LIBRI/LIBRI', -my $debug = shift @ARGV; +BEGIN { + eval "use Data::Dump"; + + if (! $@) { + *Dumper = *Data::Dump::dump; + } else { + use Data::Dumper; + } +} + +my %opt; +getopts('do:l:', \%opt); + +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 => $debug, + debug => $opt{'d'} ? 2 : 0, include_deleted => 1, # read_fdt => 1, ); print "rows: ",$isis->count,"\n\n"; -for(my $mfn = 1; $mfn <= $isis->count; $mfn++) { - print STDERR Dumper($isis->to_hash($mfn)),"\n" if ($debug); +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'}); print $isis->to_ascii($mfn),"\n"; }