X-Git-Url: http://git.rot13.org/?p=Biblio-Isis;a=blobdiff_plain;f=scripts%2Fdump_isisdb.pl;h=c6f47baf84d737664a3d2e4f895bb95dbbad70a0;hp=adbc250232aa70d7b1af165e9645cabdc697c300;hb=951f761aa6cc1d1d178778b81dd52f63c0c436da;hpb=2c00de890c477f7e84eefbf5555049d23b594cd3 diff --git a/scripts/dump_isisdb.pl b/scripts/dump_isisdb.pl index adbc250..c6f47ba 100755 --- a/scripts/dump_isisdb.pl +++ b/scripts/dump_isisdb.pl @@ -3,23 +3,40 @@ use strict; use blib; -use IsisDB; -use Data::Dumper; +use Biblio::Isis 0.24; +use Getopt::Std; -my $isisdb = shift @ARGV || '/data/isis_data/ps/LIBRI/LIBRI', -my $debug = shift @ARGV; +BEGIN { + eval "use Data::Dump"; -my $isis = IsisDB->new ( + if (! $@) { + *Dumper = *Data::Dump::dump; + } else { + use Data::Dumper; + } +} + +my %opt; +getopts('do:l:v', \%opt); + +my $isisdb = shift @ARGV || die "usage: $0 [-v] [-o offset] [-l limit] [-d] /path/to/isis/BIBL\n"; + +my $isis = Biblio::Isis->new ( isisdb => $isisdb, - debug => $debug, - include_deleted => 1, + debug => $opt{'d'} ? 2 : 0, + include_deleted => $opt{'v'}, # read_fdt => 1, + ignore_empty_subfields => $opt{'v'} ? 0 : 1, ); -print "rows: ",$isis->{'maxmfn'},"\n\n"; +print "rows: ",$isis->count,"\n\n"; + +my $min = $opt{o} || 1; +my $max = $isis->count; +$max = ( $min + $opt{l} - 1 ) if ($opt{l}); -for(my $mfn = 1; $mfn <= $isis->{'maxmfn'}; $mfn++) { - print STDERR Dumper($isis->to_hash($mfn)),"\n" if ($debug); +for my $mfn ($min .. $max) { + print STDERR Dumper($isis->to_hash($mfn)),"\n" if ($opt{'d'}); print $isis->to_ascii($mfn),"\n"; }