1257ac361a2f0312f7e04c90aa94e08d67730ac6
[MARC-Fast] / scripts / dump_fastmarc.pl
1 #!/usr/bin/perl -w
2
3 use strict;
4 use blib;
5
6 use MARC::Fast;
7
8 use Data::Dumper;
9
10 my $file = shift @ARGV || die "usage: $0 file.marc\n";
11 my $debug = shift @ARGV;
12
13 my $marc = new MARC::Fast(
14         marcdb => $file,
15         debug => $debug,
16 );
17
18 print STDERR "$file has ",$marc->count," records...\n\n";
19
20 for my $mfn (1 .. $marc->count) {
21         my $rec = $marc->fetch($mfn) || next;
22         print "REC $mfn\n";
23         foreach my $f (sort keys %{$rec}) {
24                 print "$f\t",$rec->{$f},"\n";
25         }
26         print "\n";
27 }