Skip to content

CGI::Cache 1.4214 fails tied filehandle output dispatch #1338

Description

@fglock

Summary

CGI::Cache 1.4214 passes its complete upstream test suite under system Perl but fails extensively under PerlOnJava because tied filehandle output dispatches to an undefined tied object.

Reproduction

Run the CPAN tester for CGI::Cache 1.4214 on PerlOnJava. The failure is recorded in CPAN random tester run 20260910-101908-8428.

The failure occurs in the upstream tests:

  • t/basic.t
  • t/buffer.t
  • t/cgi_carp.t
  • t/invalidate_cache_entry.t
  • t/non-caching.t
  • t/pause_continue.t
  • t/stop.t
  • t/user_specified_filehandle.t

The affected tests exercise CGI::Cache's tying of STDOUT, STDERR, and user-selected filehandles through CGI::Cache::CatchSTDOUT and CGI::Cache::MonitorSTDERR.

Observed results

System Perl 5.42.2 on macOS:

All tests successful.
Files=13, Tests=68
Result: PASS

PerlOnJava:

Files=13, Tests=68, 39 subtests failed
Result: FAIL

The repeated runtime exception is:

Can't call method "PRINT" on an undefined value

The PerlOnJava stack consistently enters the tied-handle path through:

TieHandle.tiedPrint
TieHandle.write
Main.run

The first test also ends with a bad plan because execution aborts after 10 of 11 tests.

Expected behavior

CGI::Cache should capture output, optionally forward it to the original output handle, restore the previous tie, and preserve the expected cached data. All 68 upstream tests pass under system Perl.

Suspected cause

This appears to be an internal PerlOnJava tied-filehandle lifecycle or dispatch bug. CGI::Cache creates a valid blessed object from TIEHANDLE, but later TieHandle.write() calls tieCall("PRINT", ...) with an undefined self value. The failure affects both output capture and error monitoring, including nested unbind/rebind and Tie::Restore operations.

The distribution is pure Perl; no XS or native-library prerequisite is involved. Its dependencies were built successfully by PerlOnJava, and the same dependency set passes the target suite under system Perl.

Acceptance criteria

  • CGI-Cache 1.4214 passes all 13 upstream test programs and 68 tests under the JVM backend.
  • The tied STDOUT, STDERR, and non-standard filehandle cases preserve output, cached data, and error behavior.
  • Existing tied-handle unit coverage remains passing on both JVM and interpreter backends.
  • Add a focused project-owned regression test for the failing tied-handle lifecycle before closing this issue.

Run reference

CPAN random tester run: 20260910-101908-8428

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions