Skip to content

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

Closed

Description

@fglock

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.

Activity

  1. added
    bugSomething isn't working
    area:runtimeCore Perl runtime semantics
    area:cpan-portCPAN compatibility ports and providers
    on Sep 15, 2026
  2. fglock commented on Oct 24, 2026

    @fglock
    OwnerAuthor

    Fixed in PR #1881. HTML::Template::Compiled passed the full 38-file / 262-test suite on system Perl and PerlOnJava; the JVM and interpreter focused global-vars and line-info suites also pass. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cpan-portCPAN compatibility ports and providersarea:runtimeCore Perl runtime semanticsbugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions