From 6c2b7f8ccbc98b2911eecf9049a52f78d70e173a Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Tue, 14 Jul 2009 22:00:36 -0400 Subject: [PATCH] fix crash introduced in previous patch In the previous patch, - my @subf = $field->subfields; - (defined @subf) or @subf = (); is not equivalent to + my @subf = $field->subfields || (); as, the results of $field->subields is interpeted in scalar context, not list context, resutling in @subf containing the number of subfields, not the subfield data itself, which engenders the error Can't use string ("1") as an ARRAY ref while "strict refs" in use later on. Changing the operator to 'or' instead of '||' fixes this. Signed-off-by: Galen Charlton --- cataloguing/additem.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index 9509e43938..f11380a287 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -197,7 +197,7 @@ my ($branchtagfield, $branchtagsubfield) = &GetMarcFromKohaField("items.homebran foreach my $field (@fields) { next if ($field->tag()<10); - my @subf = $field->subfields || (); + my @subf = $field->subfields or (); # don't use ||, as that forces $field->subfelds to be interpreted in scalar context my %this_row; # loop through each subfield for my $i (0..$#subf) { -- 2.39.5