Lexical sub calls from named subs lose their binding (Test2::Tools::DOM 0.100)

Aberta
#2,138 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
22/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
java, perl
Domínio
compilers

Direção de pesquisa

Start by reproducing the failure with ./jperl -Ilib -I/private/tmp/cpan-module-classification/Mojo-DOM58-3.003/lib t/html.t, using lib/Test2/Tools/DOM.pm (lexical my sub call and my sub multi at lines 29 and 44, called from named subs) purely as the trigger. The real work is in the compiler's handling of lexical subs referenced from named subs — trace where named subs are compiled and how their pad/closure captures are built, since that is where the binding is dropped. Done means standard-Perl behaviour: no will not stay shared warnings and the t/html.t and t/synopsis.t tests passing.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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

Module

  • Distribution: Test2-Tools-DOM 0.100
  • CPAN tester report: syntax error, 2026-10-25
  • System Perl: /usr/bin/perl 5.34.1 on macOS arm64; prove -lr t/ passes 3 files / 12 tests (with cached Mojo::DOM58 3.003 added only to PERL5LIB).
  • PerlOnJava: timeout 120 ./jperl -Ilib -I/private/tmp/cpan-module-classification/Mojo-DOM58-3.003/lib t/html.t fails (10 test failures); t/synopsis.t aborts on first call.

Reproducer and cause

lib/Test2/Tools/DOM.pm declares lexical subs my sub call and my sub multi at lines 29 and 44, then calls them from named package subs (all_text, tag, attr, etc.). PerlOnJava emits Subroutine "&call" will not stay shared / &multi warnings for these references; at runtime the lexical CV is absent and calls fail with Undefined subroutine &Test2::Tools::DOM::call called (or multi) at lines 65/69.

This isolates the failure to lexical-sub binding/capture across named subroutine bodies: the compiler is treating references to lexically declared subs as closure-pad captures that are not preserved in the named subs. Standard Perl resolves these lexical sub calls correctly. The failure happens before DOM assertion behavior is exercised.

Expected

Lexical sub references from named subs retain the lexical subroutine binding and execute as on standard Perl, without undefined-subroutine errors.

Linguagem predominante
Perl
Estrelas
67
Forks
8
Merge médio
5h 12min
PRs com merge (30d)
131

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de fglock/PerlOnJava

Todas as issues de fglock/PerlOnJava

Issues semelhantes

Mais issues de Perl

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.