From 0546217cdca92f1e02432c38194a9a8e5dab55ba Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 22 Aug 2024 11:35:45 +0000 Subject: [PATCH] Bug 37709: Die and notify if file cannot be opened 1 - perl misc/migration_tools/bulkmarcimport.pl -b --file=notafile.mrc -v 2 - Output: Characteristic MARC flavour: MARC21 0 MARC records done in 0.00804400444030762 seconds 3 - Apply patch 4 - perl misc/migration_tools/bulkmarcimport.pl -b --file=notafile.mrc -v 5 - Output: Characteristic MARC flavour: MARC21 Could not open notafile.mrc: No such file or directory at misc/migration_tools/bulkmarcimport.pl line 262. Signed-off-by: Roman Dolny Signed-off-by: Julian Maurice Signed-off-by: Katrin Fischer --- misc/migration_tools/bulkmarcimport.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/misc/migration_tools/bulkmarcimport.pl b/misc/migration_tools/bulkmarcimport.pl index 8161a0bb0a..ade216e3f5 100755 --- a/misc/migration_tools/bulkmarcimport.pl +++ b/misc/migration_tools/bulkmarcimport.pl @@ -255,7 +255,9 @@ my $searcher = Koha::SearchEngine::Search->new( print "Characteristic MARC flavour: $marc_flavour\n" if $verbose; my $starttime = gettimeofday; -my $fh = IO::File->new($input_marc_file); # don't let MARC::Batch open the file, as it applies the ':utf8' IO layer +# don't let MARC::Batch open the file, as it applies the ':utf8' IO layer +my $fh = IO::File->new($input_marc_file) or die "Could not open $input_marc_file: $!"; + if ( defined $format && $format =~ /XML/i ) { # ugly hack follows -- MARC::File::XML, when used by MARC::Batch, -- 2.39.5