MooX::Options compatibility failure breaks CPAN command-line applications
Summary
MooX::Options produces an incompatible failure under PerlOnJava when a command-line class uses new_with_options. This was observed while testing JavaScript-Const-Exporter v0.1.7 and is likely to affect other CPAN applications that use MooX::Options for command-line parsing.
Reproduction
CPAN random tester run: 20260908-125510-82561
Target distribution: JavaScript-Const-Exporter v0.1.7
The target test suite passes under system Perl: all 20 test programs pass, with 11 non-skipped tests executed. Under PerlOnJava, 19 test programs pass and t/script.t fails when Test::Script launches bin/js-const.
The command-line script calls JavaScript::Const::Exporter->new_with_options. PerlOnJava reports:
Odd number of elements in hash assignment at MooX::Options/Role.pm line 331.
Odd number of elements in hash assignment at MooX::Options/Role.pm line 332.
Can't use string ("module") as a HASH ref while "strict refs" is in use at MooX::Options/Role.pm line 53.
The affected MooX::Options code is the option parsing path that assigns the return values of _options_data and _options_config into hashes and then iterates option metadata. The expected Perl behavior is a hash-like option metadata structure, but PerlOnJava receives an odd-length list or otherwise malformed value, causing the later string-as-hash-ref failure.
Secondary failure in the same test
The same PerlOnJava run also reports:
Can't locate object method "_new" via package "Unicode::GCString"
This is a separate native-dependency limitation in Unicode::LineBreak/sombok and should not be treated as proof that MooX::Options alone explains every failure in this distribution. The MooX::Options errors occur during the command-line option setup and should be isolated with a focused reproducer.
Ecosystem impact
The project reverse-dependency lookup against MetaCPAN reports:
- 56 unique runtime dependants
- 12 recent runtime dependants
Representative dependants include App-karr, OrePAN2, Kubernetes-REST, Langertha-Knarr, Map-Tube-CLI, Map-Tube, WWW-Bund, WWW-Hetzner, WWW-MetaForge, App-Oozie, and JavaScript-Const-Exporter.
This is a substantially higher-impact candidate than the related native modules in the same failure: Unicode::LineBreak has 2 runtime dependants and 0 recent dependants; Unicode::GCString has 10 and 5; sombok has none.
Expected behavior
MooX::Options should compose with Moo classes and preserve the normal Perl behavior of _options_data, _options_config, parse_options, and new_with_options. A valid invocation such as:
js-const -I t/lib -m Consts2
should parse the options, run the exporter, and produce the expected JavaScript output without hash-assignment warnings or runtime exceptions.
Suggested acceptance criteria
- Add a small project-owned regression reproducer for a Moo class using MooX::Options and new_with_options.
- Reproduce and fix the malformed return/list-context or role-composition behavior at the smallest runtime/compiler layer responsible.
- Make JavaScript-Const-Exporter t/script.t pass under both JVM and interpreter backends, once the independent Unicode::GCString prerequisite is available or bypassed in the focused test.
- Verify representative MooX::Options behavior without regressing existing Moo and option-parsing tests.
Classification
Confirmed compatibility failure in the PerlOnJava execution of a widely reused CPAN runtime dependency. The precise ownership between compiler, method dispatch, list context, and Moo role composition remains to be reduced; this issue is for investigation and porting triage, not a claim that MooX::Options itself is defective under standard Perl.
MooX::Options compatibility failure breaks CPAN command-line applications
Summary
MooX::Options produces an incompatible failure under PerlOnJava when a command-line class uses new_with_options. This was observed while testing JavaScript-Const-Exporter v0.1.7 and is likely to affect other CPAN applications that use MooX::Options for command-line parsing.
Reproduction
CPAN random tester run: 20260908-125510-82561
Target distribution: JavaScript-Const-Exporter v0.1.7
The target test suite passes under system Perl: all 20 test programs pass, with 11 non-skipped tests executed. Under PerlOnJava, 19 test programs pass and t/script.t fails when Test::Script launches bin/js-const.
The command-line script calls JavaScript::Const::Exporter->new_with_options. PerlOnJava reports:
The affected MooX::Options code is the option parsing path that assigns the return values of _options_data and _options_config into hashes and then iterates option metadata. The expected Perl behavior is a hash-like option metadata structure, but PerlOnJava receives an odd-length list or otherwise malformed value, causing the later string-as-hash-ref failure.
Secondary failure in the same test
The same PerlOnJava run also reports:
This is a separate native-dependency limitation in Unicode::LineBreak/sombok and should not be treated as proof that MooX::Options alone explains every failure in this distribution. The MooX::Options errors occur during the command-line option setup and should be isolated with a focused reproducer.
Ecosystem impact
The project reverse-dependency lookup against MetaCPAN reports:
Representative dependants include App-karr, OrePAN2, Kubernetes-REST, Langertha-Knarr, Map-Tube-CLI, Map-Tube, WWW-Bund, WWW-Hetzner, WWW-MetaForge, App-Oozie, and JavaScript-Const-Exporter.
This is a substantially higher-impact candidate than the related native modules in the same failure: Unicode::LineBreak has 2 runtime dependants and 0 recent dependants; Unicode::GCString has 10 and 5; sombok has none.
Expected behavior
MooX::Options should compose with Moo classes and preserve the normal Perl behavior of _options_data, _options_config, parse_options, and new_with_options. A valid invocation such as:
should parse the options, run the exporter, and produce the expected JavaScript output without hash-assignment warnings or runtime exceptions.
Suggested acceptance criteria
Classification
Confirmed compatibility failure in the PerlOnJava execution of a widely reused CPAN runtime dependency. The precise ownership between compiler, method dispatch, list context, and Moo role composition remains to be reduced; this issue is for investigation and porting triage, not a claim that MooX::Options itself is defective under standard Perl.