Fix HTML::Template::Compiled global variables and warning metadata

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

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
java, perl
Domain
compilers, testing

Research direction

Start by running t/08_global_vars.t and t/39_line_info.t under the JVM and interpreter backends, then compare their scope, warning, fatal-warning, and source-location behavior. Trace the include/loop path and generated or evaluated code only far enough to separate shared runtime behavior from backend-specific defects. Done means focused regressions pass, expected warnings and line metadata are preserved, and the unchanged upstream suite passes.

Written by the indexing model from the issue text.

Description

area:cpan-port area:runtime bug

Summary

HTML::Template::Compiled 1.003 passes its upstream test suite under system Perl but fails under PerlOnJava in two functional areas: global-variable/include rendering and warning plus source-line metadata propagation.

CPAN evidence

CPAN random tester run 20260915-094334-6702:

  • Distribution: HTML-Template-Compiled 1.003
  • System Perl: complete suite passes; 38 test files, 259 executed tests
  • PerlOnJava: 9 of 262 executed assertions fail across 2 of 38 test programs
  • Build and dependency setup complete successfully
  • Dependency: Parse::RecDescent 1.967015 builds and passes its own tests

The PerlOnJava failures are:

t/08_global_vars.t ............. 1 failure
t/39_line_info.t ............... 8 failures

The other 36 test programs pass, including template parameters, filters, includes, loops, expressions, encoding, plugins, precompilation, and POD-related tests.

Failure 1: global variable and include rendering

t/08_global_vars.t creates a template with global_vars => 1, a loop containing local values, and an included template that references a global value. System Perl renders the expected loop values and global values. PerlOnJava produces an empty result, causing the global_vars assertion to fail.

The test also covers an unset-variable control case and a separate global_vars => 2 nested tmpl_with case; those assertions pass. The failing behavior is therefore narrower than all global-variable or nested-scope handling.

Expected output includes:

loopvar: one ... global: 42 ... included: ...
loopvar: two ... global: 23 ... included: ...
loopvar: three ... global: 42 ... included: ...

Observed PerlOnJava output for the main assertion is empty.

Failure 2: warnings and template source line information

t/39_line_info.t renders a template containing an undefined value under three warning modes: disabled, enabled, and fatal. It runs each mode with line_info => 0 and line_info => 1.

The expected behavior under system Perl is:

  • warnings => 0: no warning and normal output
  • warnings => 1: an Use of uninitialized value warning
  • warnings => fatal: empty output and a fatal exception
  • with line_info => 1, warning and exception text identifies t.templates.line_info1.html line 4

Under PerlOnJava:

  • expected warnings are absent
  • warnings => fatal does not stop output
  • expected source-line metadata is absent

This produces 8 failed assertions in the test.

Suspected ownership

The failures are pure-Perl compatibility defects attributable to PerlOnJava. The exact ownership should be reduced before implementation:

  1. For global_vars, inspect template include execution, scope lookup, and output-buffer control flow for the main global_vars => 1 loop path.
  2. For t/39_line_info.t, inspect warning-category emission, fatal-warning conversion, localized warning handlers, and propagation of template source locations through generated/evaluated code.
  3. Compare JVM and interpreter backends and determine whether either symptom is shared runtime behavior or backend-specific.
  4. Confirm whether the two symptoms share a scope/evaluation or generated-code cause; do not assume they are one defect solely because they occur in the same distribution.

This is not a missing service, platform prerequisite, timeout, or native/XS failure.

Regression coverage and acceptance criteria

  • Add a project-owned, system-Perl-validated regression for the smallest global_vars => 1 include/loop case that reproduces the empty output.
  • Add focused coverage for warning-disabled, warning-enabled, and fatal-warning behavior with and without template line information.
  • Preserve expected output, warning text, fatal behavior, and source location on both JVM and interpreter backends.
  • Re-run the unchanged HTML::Template::Compiled 1.003 suite and require all available upstream tests to pass.
  • Run the existing warning, scope, include, generated-code, and source-location tests to guard against regressions.

Related but distinct: #1377 concerns Log::Fine dynamic placeholders and caller metadata; it does not cover HTML::Template::Compiled global-variable rendering or warning behavior.

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.