Skip to content

MooseX::Getopt help exits without printing usage text #1421

Description

@fglock

Summary

MooseX::Getopt 0.78 loses help/usage text when help processing exits under PerlOnJava. The failure reproduces on both the JVM and interpreter backends.

Reproduction

This was reported by CPAN random tester run 20260916-111623-23683 in the MooseX::Getopt::Dashes request block. The affected upstream tests are:

t/104_override_usage.t
t/109_help_flag.t

The complete PerlOnJava run reports:

Files=29, Tests=339
9 subtests failed

Focused execution of both affected tests reproduces the same failures on both PerlOnJava backends.

Observed behavior

t/104_override_usage.t fails four assertions. With --help, and with the before/after usage-text modifiers, the captured stdout is empty. The unknown-option case still prints usage successfully.

t/109_help_flag.t fails five assertions. Each of these flags exits with status 0 but produces empty captured stdout:

--help
--usage
--?
-?
-h

The test still observes the expected exit status and no stderr output. Ordinary option parsing and the rest of the distribution’s tests pass.

Expected behavior

System Perl passes the complete upstream suite:

Files=29, Tests=339
All tests successful.

For each help flag, the usage object’s text should be written to stdout before the process exits successfully.

Analysis

This does not appear to be a MooseX::Getopt option-parsing defect: regular options and unknown-option usage output work, and system Perl passes the same tests. The common failure is that help handling calls an otherwise successful exit while the text expected by Test::Trap is absent from captured stdout.

The likely area is shared PerlOnJava handling of stdout buffering/flush behavior around exit, or interaction between that behavior and Test::Trap’s local output capture. The issue affects both execution backends, indicating shared runtime or bundled-library behavior.

Impact

Applications using MooseX::Getopt’s built-in help flags can terminate successfully without displaying their usage information, making command-line interfaces unusable or misleading on PerlOnJava.

Suggested regression coverage

Add a focused project-owned test that invokes a MooseX::Getopt class under both backends with --help (and one short alias), verifies exit status 0, and asserts that the generated usage text is present on stdout and absent from stderr. Also cover output flushing when a successful exit occurs inside a captured-output scope.

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

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions