Parser rejects valid heredoc END statement under strict subs

Open
#1,411 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
perl
Domain
compilers

Research direction

Start with the failing t/Tools_Error.t case and reproduce the construct under both the JVM and interpreter backends. Trace how the parser/compiler handles a single-quoted heredoc followed by bareword END under strict subs, then add the suggested focused regression test and confirm the full affected test passes on both backends.

Written by the indexing model from the issue text.

Description

bug

Summary

PerlOnJava rejects valid Perl heredoc syntax in Test-Mockify 1.3. The upstream test suite passes the affected test under system Perl, but PerlOnJava rejects the bareword END after the heredoc terminator while strict subs is enabled.

Reproduction

CPAN compatibility run: 20260916-111623-23683

Distribution: Test-Mockify 1.3

Failing test: t/Tools_Error.t

The relevant source pattern is:

return <<'END_REGEX';
...
END_REGEX
END;

The final END; is accepted by standard Perl, but PerlOnJava reports:

Bareword "END" not allowed while "strict subs" is in use

The CPAN run executed 24 test files and 405 tests. All other test files passed; t/Tools_Error.t aborted during compilation with no subtests run.

Comparison

  • System Perl: t/Tools_Error.t passes, 4/4 tests.
  • PerlOnJava JVM backend: fails at t/Tools_Error.t line 84.
  • PerlOnJava interpreter backend: fails on the same construct, with the diagnostic pointing at line 75 due to backend-specific source accounting.

This is reproducible without modifying the distribution and affects both execution backends, indicating a shared parser/compiler incompatibility rather than a runtime or dependency issue.

Expected behavior

The test should compile and pass as it does under standard Perl. The END; statement following the END_REGEX heredoc should not be diagnosed as an invalid strict-subs bareword.

Suggested regression coverage

Add a focused project-owned unit test covering a single-quoted heredoc followed by a bareword END; under use strict, and require it to pass on both the JVM and interpreter backends.

Investigation notes

The archived record is FAIL Test::Mockify Test::Mockify::CompatibilityTools, with 405 tests recorded and no dependency/build failure. A duplicate search for Test-Mockify and Bareword END strict subs found no existing matching issue.

Dominant language
Perl
Stars
64
Forks
6
Avg merge
5h 25m
Merged PRs (30d)
157

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from fglock/PerlOnJava

All issues in fglock/PerlOnJava

Similar issues

More Perl issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.