/[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

Annotation of /trunk/scripts/dump_fastmarc.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6 - (hide annotations)
Sun Dec 18 23:12:26 2005 UTC (18 years, 4 months ago) by dpavlin
File MIME type: text/plain
File size: 698 byte(s)
added to_hash, small fix to test, better output in dump_fastmarc.pl [0.02]

1 dpavlin 1 #!/usr/bin/perl -w
2    
3     use strict;
4     use blib;
5    
6     use MARC::Fast;
7 dpavlin 4 use Getopt::Std;
8 dpavlin 1 use Data::Dumper;
9    
10 dpavlin 4 my %opt;
11     getopts('dn:', \%opt);
12 dpavlin 1
13 dpavlin 4 my $file = shift @ARGV || die "usage: $0 [-n number] [-d] file.marc\n";
14    
15 dpavlin 1 my $marc = new MARC::Fast(
16     marcdb => $file,
17 dpavlin 4 debug => $opt{'d'},
18 dpavlin 1 );
19    
20    
21 dpavlin 4 my $min = 1;
22     my $max = $marc->count;
23    
24     if (my $mfn = $opt{'n'}) {
25     $min = $max = $mfn;
26 dpavlin 6 print STDERR "Dumping $mfn only\n";
27     } else {
28     print STDERR "$file has $max records...\n";
29 dpavlin 4 }
30    
31     for my $mfn ($min .. $max) {
32 dpavlin 1 my $rec = $marc->fetch($mfn) || next;
33 dpavlin 6 print Dumper($rec);
34 dpavlin 1 print "REC $mfn\n";
35 dpavlin 3 foreach my $f (sort keys %{$rec}) {
36 dpavlin 6 print "$f\t", join('', $rec->{$f}) ,"\n";
37 dpavlin 1 }
38     print "\n";
39 dpavlin 6 print Dumper($marc->to_hash($mfn));
40 dpavlin 1 }

Properties

Name Value
svn:executable

  ViewVC Help
Powered by ViewVC 1.1.26