Implement B::cstring for PerlOnJava regex stringification

Offen
#2,109 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Anfängerfreundlichkeit
48/100
Issue-Typ
Feature
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
perl
Bereich
backend

Rechercherichtung

Start with src/main/perl/lib/B.pm and compare B::cstring behavior with system Perl for the string and regexp cases listed in the acceptance criteria. Then add focused regression coverage, validate it with standard Perl and both PerlOnJava backends, and run all eight Regexp-Lexer 0.05 test files; done means the behavior is compatible and those tests pass.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

area:regex area:runtime bug

Summary

Implement Perl-compatible B::cstring support in PerlOnJava's B module. Regexp::Lexer 0.05 uses this core B helper to turn a compiled regexp into a quoted string before tokenizing it. PerlOnJava's B.pm is a partial stub and does not define cstring, so the module loads but its tokenizer fails at runtime.

This is related to the broader B compatibility exploration in #1291, but is a standalone pure-Perl API gap: the reproducer does not require B::Utils or XS.

Reproducer

use B;
my $quoted = B::cstring(qr/foo/i);
print "$quoted\n";

With system Perl 5.34.1, this prints:

"(?^i:foo)"

On PerlOnJava at 168259c9e, both the JVM and interpreter backends exit 255 with:

Undefined subroutine &B::cstring called at -e line 1.

CPAN evidence

  • Distribution: Regexp-Lexer 0.05 (MOZNION/Regexp-Lexer-0.05)
  • Archived random tester run: 20261118-104825-43075
  • Failing files: t/01_basic.t, t/03_escaped_N.t, t/04_double_quote.t, t/05_empty.t, and both tests under t/10_with_not_meta_newline/
  • All six runtime failures terminate in Regexp::Lexer::tokenize at its B::cstring($re) call. t/00_compile.t and t/02_exceptional.t pass.
  • The full upstream suite passes on system Perl 5.34.1: 8 files, 10 tests, recursive prove with the distribution's lib directory on @INC.

Root cause

src/main/perl/lib/B.pm implements a minimal subset of Perl's B module, but has no cstring function. The repository's XString::cstring helper quotes a supplied string; it does not implement the B::cstring interface or itself obtain the Perl string form of a regexp. The upstream module relies on B::cstring's quoted regexp string, including modifier representation and escaping, so a plain B::perlstring call is not automatically a compatible substitute.

Acceptance criteria

  • Provide B::cstring behavior compatible with system Perl for strings and compiled regexps, including escaped metacharacters, quotes, backslashes, modifiers, and Unicode/byte strings as applicable.
  • Add focused project regression coverage validated first with standard Perl, then on both PerlOnJava backends.
  • Re-run all eight Regexp-Lexer 0.05 test files and confirm the CPAN failure is resolved.
Vorherrschende Sprache
Perl
Sterne
67
Forks
8
Ø Merge
5 Std. 12 Min.
Gemergte PRs (30 T.)
131

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus fglock/PerlOnJava

Alle Issues in fglock/PerlOnJava

Ähnliche Issues

Weitere Issues zu Perl

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.