CLASS v1.1.8 constant returns main in non-main package
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 52/100
Research direction
Start by running the upstream CLASS.t coverage and the reproducer on both the JVM and interpreter backends. Trace how imported constant subroutines resolve package context, comparing the failing bare CLASS path with the working $CLASS path. Add a project-owned regression test for a constant subroutine imported into a non-main package, then verify CLASS returns Foo and CLASS->bar returns 23 on both backends.
Written by the indexing model from the issue text.
Description
Summary
CLASS v1.1.8 fails when imported into a non-main package. Its exported
constant subroutine returns main instead of the importing package, causing
class-method calls through CLASS to dispatch incorrectly.
Minimal reproducer
use CLASS;
package Foo;
use CLASS;
sub bar { 23 }
print CLASS, "\\n";
print CLASS->bar, "\\n";
Expected output under Perl:
Foo
23
Actual PerlOnJava behavior:
main
Can't locate object method "bar" via package "main"
The same failure is covered by upstream CLASS.t:
package Foo;
use CLASS;
is( CLASS, __PACKAGE__, 'CLASS is right' );
is( CLASS->bar, 23, 'CLASS->meth' );
Reproduction results
CLASS v1.1.8, CPAN run20260916-111623-23683- System Perl 5.42.2: all 22 tests pass
- PerlOnJava JVM backend: fails at
CLASS is right(mainvsFoo), then
aborts atCLASS->bar - PerlOnJava interpreter backend: same failure
- CPAN result: 1/2 test programs failed; 1/3 executed tests failed
The distribution is pure Perl and does not require XS or native libraries.
Because both PerlOnJava backends reproduce the issue while system Perl passes,
this appears to be a shared compiler/runtime bug involving imported constant
subroutines and package context. The $CLASS variable exported by the module
does return Foo; the bare CLASS constant is the failing path.
Acceptance criteria
CLASS v1.1.8's upstream test suite passes completely on both PerlOnJava
backends.- The reproducer returns
Fooand then23. - A permanent project-owned regression test covers an imported constant
subroutine in a non-mainpackage.
- Dominant language
- Perl
- Stars
- 64
- Forks
- 6
- Avg merge
- 5h 25m
- Merged PRs (30d)
- 157
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from fglock/PerlOnJava
-
area:cpan-port area:unicode bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
fglock/PerlOnJava#1341 ·
-
area:cpan-port bug
Difficulty 4/5 3-5 days Newbie friendliness 44/100
fglock/PerlOnJava#1459 ·
-
area:cpan-port bug
Difficulty 3/5 1-2 days Newbie friendliness 72/100
fglock/PerlOnJava#1457 ·
-
bug high-impact
Difficulty 3/5 1-2 days Newbie friendliness 67/100
fglock/PerlOnJava#1456 · 1 comment ·
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 72/100
fglock/PerlOnJava#1455 ·
All issues in fglock/PerlOnJava
Similar issues
-
1.severity: security
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
api7/lua-resty-saml#63 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100