Skip to content

Commit fba8dfd

Browse files
committed
Fix warnings that occur when the Accounts Manager page is loaded.
With perl 5.38 the sorting of users at the end of the `pre_header_initialize` method in `lib/WeBWorK/ContentGenerator/Instructor/UserList.pm` is now issuing the warning `Implicit use of @_ in subroutine entry with signatured subroutine is experimental at /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Instructor/UserList.pm line 239.` This warning is really a false positive as `@_` is not actually used by the sort methods. They instead use the global `$a` and `$b` variables. However, perl thinks that since the arguments are not explicitly listed that `@_` is being passed. To fix this the sort subroutines need to be explicitly called with no arguments. Note that this warning is only shown in the console. This means that if you are running webwork2 via hypnotoad started from the webwork2 systemd service, then you won't see these warnings.
1 parent 6d96fda commit fba8dfd

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

lib/WeBWorK/ContentGenerator/Instructor/UserList.pm

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,16 @@ sub pre_header_initialize ($c) {
236236

237237
# Always have a definite sort order in case the first three sorts don't determine things.
238238
$c->{sortedUserIDs} = [
239-
map { $_->user_id }
240-
sort { &$primarySortSub || &$secondarySortSub || &$ternarySortSub || byLastName || byFirstName || byUserID }
241-
grep { $c->{visibleUserIDs}{ $_->user_id } } (values %allUsers)
239+
map { $_->user_id }
240+
sort {
241+
$primarySortSub->()
242+
|| $secondarySortSub->()
243+
|| $ternarySortSub->()
244+
|| byLastName()
245+
|| byFirstName()
246+
|| byUserID()
247+
}
248+
grep { $c->{visibleUserIDs}{ $_->user_id } } (values %allUsers)
242249
];
243250

244251
return;

0 commit comments

Comments
 (0)