[Koha-cvs] CVS: koha/misc dumpmarc.pl,1.1,1.2

Paul POULAIN tipaul at users.sourceforge.net
Wed May 21 16:19:34 CEST 2003


Update of /cvsroot/koha/koha/misc
In directory sc8-pr-cvs1:/tmp/cvs-serv13607/misc

Modified Files:
	dumpmarc.pl 
Log Message:
some improvment.
enter ./dumpmarc.pl without parameters to get help

Index: dumpmarc.pl
===================================================================
RCS file: /cvsroot/koha/koha/misc/dumpmarc.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** dumpmarc.pl	20 May 2003 15:48:23 -0000	1.1
--- dumpmarc.pl	21 May 2003 14:19:32 -0000	1.2
***************
*** 2,5 ****
--- 2,6 ----
  # small script that dumps an iso2709 file.
  
+ 
  use strict;
  
***************
*** 10,23 ****
  
  use Getopt::Long;
! my ( $input_marc_file);
  GetOptions(
!     'file:s'    => \$input_marc_file
  );
  
  my $batch = MARC::Batch->new( 'USMARC', $input_marc_file );
  $batch->warnings_off();
  $batch->strict_off();
! 
  while ( my $record = $batch->next() ) {
! 	print $record->as_formatted();
  }
--- 11,41 ----
  
  use Getopt::Long;
! my ( $input_marc_file,$number) = ('',0);
! my $version;
  GetOptions(
!     'file:s'    => \$input_marc_file,
!     'n' => \$number,
!     'v' => \$version
  );
  
+ if ($version || ($input_marc_file eq '')) {
+ 	print <<EOF
+ small script to dump an iso2709 file.
+ parameters :
+ \tv : this version/help screen
+ \tfile /path/to/file/to/dump : the file to dump
+ \tn : the number of the record to dump. If missing, all the file is dumped
+ SAMPLE : ./dumpmarc.pl -file /home/paul/koha.dev/local/npl -n 1
+ EOF
+ ;
+ die;
+ }
+ 
  my $batch = MARC::Batch->new( 'USMARC', $input_marc_file );
  $batch->warnings_off();
  $batch->strict_off();
! my $i=1;
  while ( my $record = $batch->next() ) {
! 	print "\n".$record->as_formatted() if ($i eq $number || $number eq 0);
! 	$i++;
  }





More information about the Koha-cvs mailing list