/[webpac]/branches/drustvene/tools/dump_marc.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 /branches/drustvene/tools/dump_marc.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 603 - (hide annotations)
Mon Dec 27 21:00:20 2004 UTC (16 years, 2 months ago) by dpavlin
File MIME type: text/plain
File size: 579 byte(s)
upgrade from MARC to MARC::File::USMARC

1 dpavlin 61 #!/usr/bin/perl -w
2    
3     use strict;
4 dpavlin 603 use MARC::File::USMARC;
5 dpavlin 61
6     my $file = shift @ARGV || die "Usage: $0 [marc file]";
7    
8 dpavlin 603 my $marc_file = MARC::File::USMARC->in($file) || die $MARC::File::ERROR;
9 dpavlin 61
10 dpavlin 603 sub marc_count {
11     my $filename = shift || die;
12     my $file = MARC::File::USMARC->in($filename) || die $MARC::File::ERROR;
13     my $count = 0;
14     while ($file->skip()) {
15     $count++;
16     }
17     return $count;
18     }
19 dpavlin 209
20 dpavlin 603 print "file '$file' with ",marc_count($file)," records...\n";
21 dpavlin 209
22 dpavlin 603 my $i = 1;
23     while( my $marc = $marc_file->next() ) {
24     print "REC #",$i++,": ",$marc->title,"\n";
25     print $marc->as_formatted,"\n\n";
26 dpavlin 61 }
27    

Properties

Name Value
cvs2svn:cvs-rev 1.2
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26