Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Allow Moo constant closures capturing lexical values

Chiusa
#1,477 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
52/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
perl
Ambito
compilers

Direzione di ricerca

Start with Moo/_Utils.pm around lines 216 and 221, then trace the BEGIN block and its string eval into PerlOnJava's constant-subroutine and lexical-capture handling. Reproduce with use Moo; on both backends and compare with standard Perl. Done means Moo loads successfully without the invalid constant-closure diagnostic and the MooX::Options::Actions basic test runs.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area:backend area:cpan-port area:parser area:runtime bug

Summary

PerlOnJava cannot compile Moo because it rejects the generated constant closure in Moo::_Utils. This prevents MooX::Options::Actions 0.001 from loading, even though the complete upstream suite passes under standard Perl.

Reproduction

The failure was found in CPAN random run 20260921-124328-13959 while testing MooX::Options::Actions 0.001. Its dependency chain includes MooX::Options 4.103 and Moo.

The smallest reproducer is:

use Moo;

On both the JVM backend and the interpreter backend, PerlOnJava reports:

Constants from lexical variables potentially modified elsewhere are no longer permitted
at Moo/_Utils.pm line 216.
BEGIN failed--compilation aborted at Moo/_Utils.pm line 221
Compilation failed in require

The error is raised while compiling Moo's BEGIN block that constructs a constant helper from a lexical expression involving ${^GLOBAL_PHASE}. Standard Perl accepts and loads this code.

CPAN evidence

The standard-Perl oracle passes the upstream distribution:

t/basic.t .............. ok
All tests successful.
Files=2, Tests=8
Result: PASS

Under PerlOnJava, t/author-pod-syntax.t is skipped as intended, but t/basic.t aborts before running any tests:

t/basic.t ..............
Dubious, test returned 255
No subtests run
Files=2, Tests=0

The dependency installation completed successfully. This is not a missing dependency or timeout; the failure occurs in PerlOnJava's bundled Moo implementation during compilation.

Expected behavior

PerlOnJava should accept Moo's generated constant subroutine and load Moo successfully. The diagnostic should not be emitted for the valid lexical-closure pattern used by current Moo releases.

Suspected area

Compiler handling of constant subroutines and lexical capture analysis, especially code generated by string eval inside a BEGIN block. The implementation appears to reject a pattern that standard Perl permits when a lexical value is captured by a constant subroutine.

Environment and scope

  • Distribution: MooX::Options::Actions 0.001
  • Dependencies: MooX::Options 4.103, Moo
  • PerlOnJava backends: JVM and interpreter
  • PerlOnJava reports Perl 5.044001
  • Standard Perl oracle: Perl 5.42.2 on macOS
  • Native/XS code in the affected distribution: none
  • Reverse-dependency analysis: not applicable; this is a pure-Perl compatibility failure

This failure is separate from the unrelated Ambiguous call resolved as CORE::try() warnings emitted by the same run.

Lingua principale
Perl
Stelle
64
Fork
7
Merge medio
4h 29m
PR unite (30g)
176

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di fglock/PerlOnJava

Tutte le issue di fglock/PerlOnJava

Issue simili

Altre issue su Perl

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.