--- trunk/scripts/dump_isis.pl 2004/12/29 16:01:41 9 +++ trunk/scripts/dump_isisdb.pl 2006/07/07 21:11:01 50 @@ -3,18 +3,39 @@ use strict; use blib; -use IsisDB; -use Data::Dumper; +use Biblio::Isis; +use Getopt::Std; -my $isis = IsisDB->new ( - isisdb => shift @ARGV || '/data/isis_data/ps/LIBRI/LIBRI', - debug => shift @ARGV, +BEGIN { + eval "use Data::Dump"; + + if (! $@) { + *Dumper = *Data::Dump::dump; + } else { + use Data::Dumper; + } +} + +my %opt; +getopts('dn:', \%opt); + +my $isisdb = shift @ARGV || die "usage: $0 [-n number] [-d] /path/to/isis/BIBL\n"; + +my $isis = Biblio::Isis->new ( + isisdb => $isisdb, + debug => $opt{'d'} ? 2 : 0, include_deleted => 1, +# read_fdt => 1, ); -print "rows: ",$isis->{'maxmfn'},"\n\n"; +print "rows: ",$isis->count,"\n\n"; + +my $min = 1; +my $max = $isis->count; +$max = $opt{n} if ($opt{n}); -for(my $mfn = 1; $mfn <= $isis->{'maxmfn'}; $mfn++) { +for my $mfn ($min .. $max) { + print STDERR Dumper($isis->to_hash($mfn)),"\n" if ($opt{'d'}); print $isis->to_ascii($mfn),"\n"; }