Skip to content

Commit

Permalink
Merge pull request openwebwork#2420 from pstaabp/fix/array-signature-…
Browse files Browse the repository at this point in the history
…warning

Fix warning that occurs on perl 5.36+ for using @_ in function signatures
  • Loading branch information
Alex-Jordan authored Jun 12, 2024
2 parents 948ee7e + f97c3fd commit 7569e74
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/WeBWorK/Controller.pm
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ use WeBWorK::Localize;
# FIXME: This override should be dropped and the Mojolicious::Controller param and every_param methods used directly.
# Mojolicious already keeps a cache of parameter values and also allows setting of parameters. So everything done here
# is redundant.
sub param ($c, $name = undef, $val = undef) {
sub param ($c, @opts) {
my ($name, $val) = @opts;
if (!defined $c->{paramcache}) {
for my $name (@{ $c->req->params->names }) {
$c->{paramcache}{$name} = $c->req->every_param($name);
Expand All @@ -43,7 +44,7 @@ sub param ($c, $name = undef, $val = undef) {

return keys %{ $c->{paramcache} } unless $name;

if (@_ == 3) {
if (@opts == 2) {
if (!defined $val) {
$c->{paramcache}{$name} = [];
} elsif (ref $val eq 'ARRAY') {
Expand Down

0 comments on commit 7569e74

Please sign in to comment.