From: Colin Campbell Date: Thu, 4 Apr 2013 09:54:03 +0000 (+0100) Subject: Bug 6554 Fix error caused by modifying $_ in a map X-Git-Url: http://git.rot13.org/?p=koha.git;a=commitdiff_plain;h=e98fe7e32244fa11d218b4d2a1006eea547e70d8 Bug 6554 Fix error caused by modifying $_ in a map Error 'Modification of a read-only value attempted' triggered on login because of manipulation of $_ in the map Moved the mod to a loop as recommended in the doc for map Signed-off-by: Marcel de Rooy Signed-off-by: Jared Camins-Esakov --- diff --git a/C4/Context.pm b/C4/Context.pm index 4d170b2fb6..fee87520c9 100644 --- a/C4/Context.pm +++ b/C4/Context.pm @@ -1104,9 +1104,22 @@ set_userenv is called in Auth.pm #' sub set_userenv { - my ($usernum, $userid, $usercnum, $userfirstname, $usersurname, $userbranch, $branchname, $userflags, $emailaddress, $branchprinter, $persona)= - map { utf8::decode($_); $_ } # CGI::Session doesn't handle utf-8, so we decode it here - @_; + my ( + $usernum, $userid, $usercnum, $userfirstname, + $usersurname, $userbranch, $branchname, $userflags, + $emailaddress, $branchprinter, $persona + ) = @_; + for ( + $usernum, $userid, $usercnum, $userfirstname, + $usersurname, $userbranch, $branchname, $userflags, + $emailaddress, $branchprinter, $persona + ) + { + utf8::decode($_) if $_; + } + + # CGI::Session doesn't handle utf-8, so we decode it here + my $var=$context->{"activeuser"} || ''; my $cell = { "number" => $usernum,