X-Git-Url: http://git.rot13.org/?p=Biblio-Isis;a=blobdiff_plain;f=scripts%2Fdump_isisdb.pl;h=c6f47baf84d737664a3d2e4f895bb95dbbad70a0;hp=d923ba70bb6ea53c1c6e993715ba4c197cdffe56;hb=HEAD;hpb=a0f367ba3475ceac5185dc8c18b387795415e1b1 diff --git a/scripts/dump_isisdb.pl b/scripts/dump_isisdb.pl index d923ba7..c6f47ba 100755 --- a/scripts/dump_isisdb.pl +++ b/scripts/dump_isisdb.pl @@ -1,29 +1,39 @@ #!/usr/bin/perl -w use strict; -#use blib; +use blib; -use Biblio::Isis; +use Biblio::Isis 0.24; 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:v', \%opt); -my $isisdb = shift @ARGV || die "usage: $0 [-n number] [-d] /path/to/isis/BIBL\n"; +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 => $opt{'d'}, - 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->count,"\n\n"; -my $min = 1; +my $min = $opt{o} || 1; my $max = $isis->count; -$max = $opt{n} if ($opt{n}); +$max = ( $min + $opt{l} - 1 ) if ($opt{l}); for my $mfn ($min .. $max) { print STDERR Dumper($isis->to_hash($mfn)),"\n" if ($opt{'d'});