Skip to content

fix: FindBin::libs — jar lib decoding, Symbol::qualify_to_ref, ref-to-glob context#727

Merged
fglock merged 6 commits into
masterfrom
fix/findbin-libs-symbol
May 13, 2026
Merged

fix: FindBin::libs — jar lib decoding, Symbol::qualify_to_ref, ref-to-glob context#727
fglock merged 6 commits into
masterfrom
fix/findbin-libs-symbol

Conversation

@fglock
Copy link
Copy Markdown
Owner

@fglock fglock commented May 13, 2026

Summary

Fixes ./jcpan -t FindBin::libs and tightens related compilation/runtime behavior.

Changes

  • Jar PERL5LIB loads: Read raw bytes from the jar resource and decode with FileUtils.decodePerlSourceBytes once CompilerOptions exists (same BOM/CRLF path as filesystem reads).
  • Native Symbol: qualify_to_ref builds a two-arg qualify using RuntimeCode.caller at entry (matches Perl’s embedded qualify + caller); glob refs use GlobalVariable.getGlobalIO instead of orphan RuntimeGlob instances.
  • \*{ … }: Emit reference-to-glob with scalar context for the *{…} operand (EmitOperator).
  • Parser: *{EXPR} parses EXPR as code; misc prototype/indirect-object and * { whitespace fixes (Variable, SubroutineParser, etc.).
  • Test::More: use_ok string-eval import list workaround for PerlOnJava.
  • Test: symbol_star_brace_qualify_to_ref.t.

Verification

  • make
  • timeout 600 ./jcpan -t FindBin::libs — PASS

fglock and others added 2 commits May 13, 2026 16:40
…-glob context

- Load jar:PERL5LIB modules via raw bytes and FileUtils.decodePerlSourceBytes after
  CompilerOptions exists (matches filesystem BOM/CRLF handling).
- Native Symbol::qualify_to_ref: qualify one-arg via caller()+two-arg qualify; return
  GlobalVariable.getGlobalIO-backed globs instead of orphan RuntimeGlob refs.
- EmitOperator: evaluate \*{...} operand in scalar context (comma/ternary inside braces).
- Parser: *{EXPR} as code; unary prototype indirect suppression; * { brace whitespace.
- Test::More: use_ok string-eval visibility for \@imports under PerlOnJava.
- Add unit test symbol_star_brace_qualify_to_ref.t.

Verified: make; timeout 600 ./jcpan -t FindBin::libs.

Generated with [Cursor](https://cursor.com/docs)

Co-Authored-By: Cursor <noreply@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
PR727 parsed every *{...} as ParseBlock, so *{P2::ISA} became a useless statement and
strict subs rejected the bareword (mro/basic.t, basic_utf8.t showed 0/0 in harness logs).

Try IdentifierParser for a single qualified name through `}`; otherwise ParseBlock for
Symbol::qualify_to_ref-style expressions.

Generated with [Cursor](https://cursor.com/docs)

Co-Authored-By: Cursor <noreply@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@fglock fglock force-pushed the fix/findbin-libs-symbol branch from 5aac10a to c9511f8 Compare May 13, 2026 14:41
fglock and others added 4 commits May 13, 2026 16:50
…around)

eval STRING already snapshots outer lexicals (EmitEval + EvalStringHandler /
RuntimeCode.evalStringHelper BEGIN-alias path), so \@{$args[0]} inside use_ok's
generated eval sees @_eval's @Args like perl(1). The package-array shim was
unnecessary.

Add unit/eval_string_lexical_args_use.t covering the @{$args[0]} pattern.

Generated with [Cursor](https://cursor.com/docs)

Co-Authored-By: Cursor <noreply@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
- qx/Heredoc-qx: disable ${\"…\"} braced preprocessing except in qq strings so
  `${\"hello"}` stays ref-to-string inside backticks; thread flag through
  ParseHeredoc/StringParser/StringDoubleQuoted and Parser state.
- Runtime readpipe overrides: dispatch via InterpreterState package + RuntimeArray
  args to the package CV; empty exec() returns false and sets ENOENT (no throw).
- Prototype parsing: qw-merge lookahead only for consecutive `$` slots so `$_`
  builtins like unpack no longer mis-parse as syntax errors.
- Builtin arity messages: pass builtin names into parseZeroOrOneList for defined,
  undef, and unary builtins; empty pack reports Not enough arguments for pack.

Verified: perl5_t/t/op/exec.t (41/41), perl5_t/t/comp/bproto.t (16/16), make.

Generated with [Cursor](https://cursor.com/docs)

Co-Authored-By: Cursor <noreply@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…s `sub new`

`subExists && prototypeStartsWithScalarSlot` skipped the indirect-object probe; inside a
package that defines `new ($...)`, `new Parse::RecDescent::Directive(...)` was parsed as a
direct call to the enclosing `new`, breaking Parse::RecDescent / DBIx::Class).

Always run the probe when the method bareword is `new`.

Verified: require Parse::RecDescent from ~/.perlonjava/lib; make.

Generated with [Cursor](https://cursor.com/docs)

Co-Authored-By: Cursor <noreply@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
The scalar-leading-prototype heuristic skipped the indirect-object probe entirely,
which mis-parsed `method Some::Long::Class LIST` as a direct call to an enclosing
sub when that sub had a `$`-leading prototype (e.g. Parse::RecDescent).

Perl does not single out `new`; always attempt the probe and rely on existing
rejection/backtracking for ambiguous cases.

Verified: make; `require Parse::RecDescent` under jperl.

Generated with [Cursor](https://cursor.com/docs)

Co-Authored-By: Cursor <noreply@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@fglock fglock merged commit 49f3ddd into master May 13, 2026
2 checks passed
@fglock fglock deleted the fix/findbin-libs-symbol branch May 13, 2026 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant