2 # small script that dumps an iso2709 file.
7 # find Koha's Perl modules
8 # test carefully before changing this
10 eval { require "$FindBin::Bin/kohalib.pl" };
14 use MARC
::File
::USMARC
;
19 my ( $input_marc_file,$number,$nowarning) = ('',0);
22 'file:s' => \
$input_marc_file,
28 warn "NUM : $number\n";
29 if ($version || ($input_marc_file eq '')) {
31 small script to dump an iso2709 file.
33 \tv : this version/help screen
34 \tfile /path/to/file/to/dump : the file to dump
35 \tn : the number of the record to dump. If missing, all the file is dumped
36 \tw : warning and strict off. If your dump fail, try -w option. It it works, then, the file is iso2709, but a buggy one !
37 SAMPLE : ./dumpmarc.pl -file /home/paul/koha.dev/local/npl -n 1
43 my $batch = MARC
::Batch
->new( 'USMARC', $input_marc_file );
44 $batch->warnings_off() unless $nowarning;
45 $batch->strict_off() unless $nowarning;
47 while ( my $record = $batch->next() ) {
48 print "\nNUMBER $i =>\n".$record->as_formatted() if ($i eq $number || $number eq 0);
51 print "\n==================\n$i record parsed\n";