Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Parser rejects valid `return sort map` in Mojolicious 9.49

未关闭
#1,506 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
java, perl

调研方向

The issue is in the parser's diagnostic logic for the return statement, likely in the file handling the commit d4ebdd9b4. Start by examining the parser's grammar for return and the diagnostic for indirect map/grep arguments. The failing code is in Mojo/Loader.pm line 37. Write a test that reproduces the error with return sort map ... and ensure the diagnostic only triggers for return map/grep ... without an intervening list operator like sort.

由索引模型根据 Issue 内容生成。

描述

bug

Summary

PerlOnJava cannot load Mojolicious 9.49 because the parser rejects valid Perl in Mojo::Loader::find_packages:

return sort map { /^(.+)::$/ ? "${ns}::$1" : () } keys %{"${ns}::"};

The error is:

Missing comma after first argument to return

This causes WebService-Rollbar-Notifier 1.002011 to fail its load tests.

Reproduction

Archived CPAN run: 20260924-085657-82687

Target distribution: WebService-Rollbar-Notifier-1.002011

The target fails 2 of 3 tests in t/00-load.t while loading Mojo::UserAgent and WebService::Rollbar::Notifier. The failure reproduces on both the JVM and interpreter backends.

A minimal load reproducer is:

PERL5LIB=<Mojolicious-lib> ./jperl -MMojo::Loader -e 'print "loaded\\n"'
PERL5LIB=<Mojolicious-lib> ./jperl --interpreter -MMojo::Loader -e 'print "loaded\\n"'

Both report the diagnostic at Mojo/Loader.pm line 37. System Perl loads the same module successfully.

Expected behavior

Mojo::Loader should compile successfully. System Perl passes Mojolicious 9.49's complete suite (4,194 tests) and the Rollbar distribution's 5 tests.

Suspected cause

The regression appears related to the indirect return map/grep diagnostic added in commit d4ebdd9b4 (fix: diagnose indirect map arguments to return). The diagnostic logic appears to treat return sort map ... as an invalid indirect map argument, although the intervening sort makes this valid Perl.

Requested fix

Restrict the diagnostic to actual indirect return NAME map/grep ... forms while preserving valid list operators such as return sort map .... Add a focused regression test for the Mojolicious expression and retain the existing diagnostic coverage.

主要语言
Perl
星标
64
派生
6
平均合并
5 小时 38 分钟
30 天内合并 PR
170

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

fglock/PerlOnJava 的其他 Issue

查看 fglock/PerlOnJava 的全部 Issue

相似的 Issue

更多 Perl Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。