MakeMaker maps a root module to its first helper package
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 68/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- java
- 领域
- build-system
调研方向
Start with _root_pm_install_path in src/main/perl/lib/ExtUtils/MakeMaker.pm, which returns on the first package matching NAME or NAME::. Change it to scan all package declarations in the root .pm, prefer an exact NAME match, and fall back to a nested declaration only when none exists. Add a MakeMaker regression test with a root module that declares a nested helper package first, and check that the file stages at the exact main-module path.
由索引模型根据 Issue 内容生成。
描述
Summary
The PerlOnJava CPAN run for Algorithm-Tree-NCA 0.02 fails because the MakeMaker compatibility layer stages its main module at the wrong path. The distribution provides a single root-level NCA.pm, but that file declares a helper package before its main package. PerlOnJava maps it to the helper package path, so the distribution's test programs cannot load Algorithm::Tree::NCA.
Evidence
- CPAN random-tester run:
20261015-111423-76219 - Distribution:
Algorithm-Tree-NCA0.02 (Algorithm::Tree::NCA) - Upstream files:
t/basic.t,t/preprocess.t, andt/random.t - System Perl 5.42.2: PASS; all 3 files and 16 tests pass.
- PerlOnJava CPAN test: FAIL; all 3 files stop before executing assertions because
Algorithm/Tree/NCA.pmcannot be found (0/0 assertions ran). - The PerlOnJava MakeMaker output maps
NCA.pmtoAlgorithm/Tree/NCA/Data.pm. - The distribution has no XS/native code or external service prerequisite.
The module file begins with package Algorithm::Tree::NCA::Data; and later declares package Algorithm::Tree::NCA;. The stock MakeMaker build stages the same file as blib/lib/Algorithm/Tree/NCA.pm, after which the complete test suite passes.
Root cause
src/main/perl/lib/ExtUtils/MakeMaker.pm, in _root_pm_install_path, scans a root .pm file and returns as soon as it sees a package equal to NAME or prefixed by NAME::. For this distribution, the first matching declaration is the nested helper package Algorithm::Tree::NCA::Data, so the function immediately chooses Algorithm/Tree/NCA/Data.pm and never reaches the exact main-package declaration later in the file.
This treats the first matching package as the module represented by the file. A root file can declare helper packages before its primary package, so the exact NAME declaration needs to take precedence over nested declarations.
Proposed fix
Scan all package declarations in the root module before selecting the destination. Prefer an exact declaration matching NAME; use a nested NAME::... declaration only as a fallback when there is no exact declaration. Preserve the existing NAME-derived fallback for files with no matching package.
Add a MakeMaker regression test with a root-level module that declares a nested helper package before its main package. Verify that staging places the file at the exact main module path and that the module can be loaded from blib/lib.
Acceptance criteria
- The new regression test passes under system Perl and PerlOnJava.
Algorithm-Tree-NCA0.02's three upstream test files pass through the PerlOnJava CPAN build/test path.- Existing tests for root modules that only declare nested packages continue to stage those modules at the appropriate path.
Related issues
These closed reports cover nearby but distinct build compatibility problems: #1279 (custom test include paths), #1372 (pm_to_blib marker creation), and #1432 (Module::Build nested-module staging). This report concerns MakeMaker choosing the wrong destination for a root-level .pm file with multiple package declarations.
- 主要语言
- Perl
- 星标
- 64
- 派生
- 7
- 平均合并
- 5 小时 31 分钟
- 30 天内合并 PR
- 214
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
fglock/PerlOnJava 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
fglock/PerlOnJava#1579 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 48/100
fglock/PerlOnJava#1835 ·
维护者通常 1 天内回复
-
难度 3/5 半天 新手友好度 45/100
fglock/PerlOnJava#1808 ·
维护者通常 1 天内回复
-
area:cpan-port area:runtime bug
难度 4/5 3-5 天 新手友好度 28/100
fglock/PerlOnJava#1802 · 2 条评论 ·
维护者通常 1 天内回复
-
area:backend area:cpan-port area:runtime bug
难度 4/5 3-5 天 新手友好度 30/100
fglock/PerlOnJava#1801 ·
维护者通常 1 天内回复
查看 fglock/PerlOnJava 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 80/100
jimsalterjrs/sanoid#1116 · 1 个 reaction ·
-
Add .gitattributes so share/skel keeps LF on a Windows git checkout可能已有人在做 @sadhana-s-codez 于 2 天前认领。 未关闭
难度 1/5 1 小时以内 新手友好度 85/100
PerlDancer/Dancer2#1854 · 1 条评论 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
major/MySQLTuner-perl#1007 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100
-
难度 1/5 1 小时以内 新手友好度 88/100