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 <f.demians@tamil.fr>

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 <Katrin.Fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
Colin Campbell 2014-07-14 16:28:27 +01:00 committed by Tomas Cohen Arazi
parent 9f989999b7
commit da270d9c9b
1 changed files with 1 additions and 1 deletions

View File

@ -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);