From da270d9c9b199a407af59598a4ed820f311349f5 Mon Sep 17 00:00:00 2001 From: Colin Campbell Date: Mon, 14 Jul 2014 16:28:27 +0100 Subject: [PATCH] Bug 12573: Use correct comparison for comparing strings Perl issues a warning when you try to do a numeric comparison on non numeric values. While in 99% of the caeses numeric and string comparison behave similarly when they dont tracking down resulting bugs is hard. Also we dont want to be logging errors for normal operations. replace numeric == with eq (also switched to non-interpolating quotes so we dont generate a warning from static code checkers like perlcritic) Signed-off-by: Frederic Demians I can get this warnings in log files. This patch make perfectly sense. MARC subfield code should never be tested with Perl == operator, since the code could be letter or a number. Perl eq operator do an implicit string conversion for value which is a number, so it will work in any case. Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- authorities/blinddetail-biblio-search.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/authorities/blinddetail-biblio-search.pl b/authorities/blinddetail-biblio-search.pl index a196396469..d0f4069e3d 100755 --- a/authorities/blinddetail-biblio-search.pl +++ b/authorities/blinddetail-biblio-search.pl @@ -86,7 +86,7 @@ if ($authid) { # Get all values for each distinct subfield my %subfields; for ( $field->subfields ) { - next if $_->[0] == "9"; # $9 will be set with authid value + next if $_->[0] eq '9'; # $9 will be set with authid value my $letter = $_->[0]; next if defined $subfields{$letter}; my @values = $field->subfield($letter); -- 2.39.5