From 342dad1a1ff81ebcf97bc61b990c8914959de083 Mon Sep 17 00:00:00 2001 From: "Flavio S. Glock" Date: Wed, 29 Apr 2026 10:38:51 +0200 Subject: [PATCH] fix(parser): make `dump` an overridable core operator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Perl marks `dump` as a builtin that user code can override via `use subs` or Exporter import. PerlOnJava's parser was unconditionally throwing "Not implemented: operator: dump" before checking for a user override, which broke any module that exports its own `dump` sub. Concretely, Data::Dump declares `use subs qw(dump)` and exports `dump` via Exporter. Inside Data/Dump.pm itself, calls like `dump(@_)` (line 82, inside `sub dd`) hit the parser's hardcoded reject path and aborted loading the module: Error: Not implemented: operator: dump at .../Data/Dump.pm line 82, near "(@_" This blocks any CPAN distribution that uses Data::Dump, e.g. CPU::Z80::Assembler::Token (`jcpan -t CPU::Z80::Assembler::Token`). Fix: add "dump" to ParserTables.OVERRIDABLE_OP so the existing `use subs` / Exporter / CORE::GLOBAL override path in ParsePrimary is consulted before CoreOperatorResolver raises the unimplemented-op error. CORE_PROTOTYPES still maps `dump` → "", so explicit `CORE::dump()` keeps hitting the unimplemented path; only user/imported `dump` subs now resolve correctly. Verified: - t/Token-new.t (CPU-Z80-Assembler-2.10) now passes 32/32 - t/Token-error.t passes 28/28 - `make` (full unit suite) BUILD SUCCESSFUL Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- src/main/java/org/perlonjava/core/Configuration.java | 4 ++-- .../java/org/perlonjava/frontend/parser/ParserTables.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/perlonjava/core/Configuration.java b/src/main/java/org/perlonjava/core/Configuration.java index 13af1cac2..0644eb8b5 100644 --- a/src/main/java/org/perlonjava/core/Configuration.java +++ b/src/main/java/org/perlonjava/core/Configuration.java @@ -33,7 +33,7 @@ public final class Configuration { * Automatically populated by Gradle/Maven during build. * DO NOT EDIT MANUALLY - this value is replaced at build time. */ - public static final String gitCommitId = "7a3b8de7c"; + public static final String gitCommitId = "5f0ebe111"; /** * Git commit date of the build (ISO format: YYYY-MM-DD). @@ -48,7 +48,7 @@ public final class Configuration { * Parsed by App::perlbrew and other tools via: perl -V | grep "Compiled at" * DO NOT EDIT MANUALLY - this value is replaced at build time. */ - public static final String buildTimestamp = "Apr 29 2026 10:20:45"; + public static final String buildTimestamp = "Apr 29 2026 10:39:59"; // Prevent instantiation private Configuration() { diff --git a/src/main/java/org/perlonjava/frontend/parser/ParserTables.java b/src/main/java/org/perlonjava/frontend/parser/ParserTables.java index b0fc3c04f..f3ad5459a 100644 --- a/src/main/java/org/perlonjava/frontend/parser/ParserTables.java +++ b/src/main/java/org/perlonjava/frontend/parser/ParserTables.java @@ -27,7 +27,7 @@ public class ParserTables { public static final Set OVERRIDABLE_OP = Set.of( "bless", "caller", "chdir", "close", "connect", - "die", "do", + "die", "do", "dump", "exec", "exit", "fork", "getpwuid", "glob",