From 327a6fca0b4ac2f8876dd9d933a5dbd59c225bc1 Mon Sep 17 00:00:00 2001 From: Matthias Meusburger Date: Wed, 26 Feb 2014 16:59:14 +0100 Subject: [PATCH] Bug 11850: [SIGNED-OFF] Adds a -append option to add data to the logfile Signed-off-by: Magnus Enger Keeps current behaviour as default. The -append option is described in the POD and works as expected. --- misc/migration_tools/bulkmarcimport.pl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/misc/migration_tools/bulkmarcimport.pl b/misc/migration_tools/bulkmarcimport.pl index 7bb6be6..c725b71 100755 --- a/misc/migration_tools/bulkmarcimport.pl +++ b/misc/migration_tools/bulkmarcimport.pl @@ -35,7 +35,7 @@ use open qw( :std :encoding(UTF-8) ); binmode( STDOUT, ":encoding(UTF-8)" ); my ( $input_marc_file, $number, $offset) = ('',0,0); my ($version, $delete, $test_parameter, $skip_marc8_conversion, $char_encoding, $verbose, $commit, $fk_off,$format,$biblios,$authorities,$keepids,$match, $isbn_check, $logfile); -my ( $insert, $filters, $update, $all, $yamlfile, $authtypes ); +my ( $insert, $filters, $update, $all, $yamlfile, $authtypes, $append ); my $cleanisbn = 1; my ($sourcetag,$sourcesubfield,$idmapfl, $dedup_barcode); my $framework = ''; @@ -56,6 +56,7 @@ GetOptions( 'fk' => \$fk_off, 'm:s' => \$format, 'l:s' => \$logfile, + 'append' => \$append, 'k|keepids:s' => \$keepids, 'b|biblios' => \$biblios, 'a|authorities' => \$authorities, @@ -76,6 +77,7 @@ GetOptions( ); $biblios ||= !$authorities; $insert ||= !$update; +my $writemode = ($append) ? "a" : "w"; if ($all) { $insert = 1; @@ -182,7 +184,7 @@ my $sth_isbn = $dbh->prepare("SELECT biblionumber,biblioitemnumber FROM biblioit $dbh->{AutoCommit} = 0; my $loghandle; if ($logfile){ - $loghandle= IO::File->new($logfile,"w") ; + $loghandle= IO::File->new($logfile, $writemode) ; print $loghandle "id;operation;status\n"; } RECORD: while ( ) { @@ -632,6 +634,10 @@ The I of records to wait before performing a 'commit' operation File logs actions done for each record and their status into file +=item B<-append> + +If specified, data will be appended to the logfile. If not, the logfile will be erased for each execution. + =item B<-t, -test> Test mode: parses the file, saying what he would do, but doing nothing. -- 1.8.3.2