From 08d15a6fd1b51435b92f1056f6735c8317636068 Mon Sep 17 00:00:00 2001 From: Colin Campbell Date: Mon, 6 Jan 2014 11:53:29 +0000 Subject: [PATCH] Bug 11478: Replace experimental given/when keywords The keywords given and when are flagged experimental in perl 5.18 and subject to change. This patch replaces the construct by an if/elsif To test: [1] Verify that prove -v t/SimpleMARC.t passes. Signed-off-by: Chris Cormack Signed-off-by: Jonathan Druart Signed-off-by: Galen Charlton --- Koha/SimpleMARC.pm | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/Koha/SimpleMARC.pm b/Koha/SimpleMARC.pm index 2195143ccc..3ffe768509 100644 --- a/Koha/SimpleMARC.pm +++ b/Koha/SimpleMARC.pm @@ -88,21 +88,19 @@ sub copy_field { $modifiers .= $modifier if grep {/$modifier/} @available_modifiers; } - foreach my $value ( @values ) { - for ( $modifiers ) { - when ( /^(ig|gi)$/ ) { + foreach my $value (@values) { + if ( $modifiers =~ m/^(ig|gi)$/ ) { $value =~ s/$regex->{search}/$regex->{replace}/ig; - } - when ( /^i$/ ) { + } + elsif ( $modifiers eq 'i' ) { $value =~ s/$regex->{search}/$regex->{replace}/i; - } - when ( /^g$/ ) { + } + elsif ( $modifiers eq 'g' ) { $value =~ s/$regex->{search}/$regex->{replace}/g; - } - default { + } + else { $value =~ s/$regex->{search}/$regex->{replace}/; - } - } + } } } update_field( $record, $toFieldName, $toSubfieldName, $dont_erase, @values ); -- 2.39.5