/[MARC-Fast]/trunk/scripts/dump_fastmarc.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/scripts/dump_fastmarc.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3 by dpavlin, Fri Apr 8 12:19:24 2005 UTC revision 4 by dpavlin, Sat Oct 8 16:32:54 2005 UTC
# Line 4  use strict; Line 4  use strict;
4  use blib;  use blib;
5    
6  use MARC::Fast;  use MARC::Fast;
7    use Getopt::Std;
8  use Data::Dumper;  use Data::Dumper;
9    
10  my $file = shift @ARGV || die "usage: $0 file.marc\n";  my %opt;
11  my $debug = shift @ARGV;  getopts('dn:', \%opt);
12    
13    my $file = shift @ARGV || die "usage: $0 [-n number] [-d] file.marc\n";
14    
15  my $marc = new MARC::Fast(  my $marc = new MARC::Fast(
16          marcdb => $file,          marcdb => $file,
17          debug => $debug,          debug => $opt{'d'},
18  );  );
19    
20  print STDERR "$file has ",$marc->count," records...\n\n";  print STDERR "$file has ",$marc->count," records...\n";
21    
22    my $min = 1;
23    my $max = $marc->count;
24    
25    if (my $mfn = $opt{'n'}) {
26            $min = $max = $mfn;
27    }
28    
29    print STDERR "Dumping $min - $max\n" if ($opt{'d'});
30    
31  for my $mfn (1 .. $marc->count) {  for my $mfn ($min .. $max) {
32          my $rec = $marc->fetch($mfn) || next;          my $rec = $marc->fetch($mfn) || next;
33          print "REC $mfn\n";          print "REC $mfn\n";
34          foreach my $f (sort keys %{$rec}) {          foreach my $f (sort keys %{$rec}) {

Legend:
Removed from v.3  
changed lines
  Added in v.4

  ViewVC Help
Powered by ViewVC 1.1.26