Lexical sub calls from named subs lose their binding (Test2::Tools::DOM 0.100)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 22/100
Research direction
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.
Written by the indexing model from the issue text.
Description
Module
- Distribution:
Test2-Tools-DOM0.100 - CPAN tester report: syntax error, 2026-10-25
- System Perl:
/usr/bin/perl5.34.1 on macOS arm64;prove -lr t/passes 3 files / 12 tests (with cachedMojo::DOM583.003 added only toPERL5LIB). - PerlOnJava:
timeout 120 ./jperl -Ilib -I/private/tmp/cpan-module-classification/Mojo-DOM58-3.003/lib t/html.tfails (10 test failures);t/synopsis.taborts 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.
- Dominant language
- Perl
- Stars
- 67
- Forks
- 8
- Avg merge
- 5h 12m
- Merged PRs (30d)
- 131
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from fglock/PerlOnJava
-
area:cpan-port bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
fglock/PerlOnJava#2153 ·
Maintainers usually reply within 1 day
-
area:cpan-port area:parser bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
fglock/PerlOnJava#2137 ·
Maintainers usually reply within 1 day
-
area:backend area:cpan-port area:runtime bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
fglock/PerlOnJava#2071 ·
Maintainers usually reply within 1 day
-
area:runtime documentation enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
fglock/PerlOnJava#1579 ·
Maintainers usually reply within 1 day
-
area:cpan-port bug
Difficulty 3/5 1-2 days Newbie friendliness 62/100
fglock/PerlOnJava#2157 ·
Maintainers usually reply within 1 day
All issues in fglock/PerlOnJava
Similar issues
-
Dev-output directory preparation accepts file-valued lib/include paths and fails on dangling linksOpenteam-cli
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
-
Difficulty 1/5 Under an hour Newbie friendliness 93/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
inverse-inc/packetfence#9728 ·
Maintainers usually reply within 1 day
-
fix(char-create): show the real reason a character is refusedPossibly taken @baphomello claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day