12 dump_fastmarc.pl - display MARC records
16 dump_fastmarc.pl /path/to/dump.marc
24 dump records starting with C<offset>
28 dump just C<limit> records
32 dump result of C<to_hash> on record
36 turn debugging output on
43 getopts('do:l:h', \%opt);
45 my $file = shift @ARGV || die "usage: $0 [-o offset] [-l limit] [-h] [-d] file.marc\n";
47 my $marc = new MARC::Fast(
54 my $max = $marc->count;
56 if (my $mfn = $opt{n}) {
58 print STDERR "Dumping $mfn only\n";
59 } elsif (my $limit = $opt{l}) {
60 print STDERR "$file has $max records, using first $limit\n";
63 print STDERR "$file has $max records...\n";
66 for my $mfn ($min .. $max) {
67 my $rec = $marc->fetch($mfn) || next;
68 print "rec is ",Dumper($rec) if ($opt{d});
70 print $marc->to_ascii($mfn),"\n";
71 print "hash is ",Dumper($marc->to_hash($mfn)) if ($opt{h});