Bug 14446: Workaround to resolve uninitialized value in goto warning
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Wed, 4 Jul 2018 14:03:33 +0000 (16:03 +0200)
committerNick Clemens <nick@bywatersolutions.com>
Fri, 13 Jul 2018 11:41:32 +0000 (11:41 +0000)
Forcing both GetTab calls to list context resolves the warning.
A workaround, not a real fix.

Test plan:
Search for something in the syspref text bar.
Without this patch, you will have a warn: Use of uninitialized value in goto
With this patch, you won't.

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

admin/preferences.pl

index 1e12b1e..988753a 100755 (executable)
@@ -229,7 +229,8 @@ sub SearchPrefs {
     our @terms = split( /\s+/, $searchfield );
 
     foreach my $tab_name ( keys %tab_files ) {
-        my $data = GetTab( $input, $tab_name );
+        # Force list context to remove 'uninitialized value in goto' warn coming from YAML::Syck; note that the other GetTab call is in list context too. The actual cause however is the null value for the pref OpacRenewalBranch in opac.pref
+        my ($data) = GetTab( $input, $tab_name );
         my $title = ( keys( %$data ) )[0];
         my $tab = $data->{ $title };
         $tab = { '' => $tab } if ( ref( $tab ) eq 'ARRAY' );