Port Variable::Magic for CPAN compatibility

Open
#1,433 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
30/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
java, perl
Domain
compilers

Research direction

Start by defining the supported Variable::Magic API and reviewing the runtime hooks available on the JVM and interpreter backends. Use t/00-compile.t, t/lvalue.t, t/lvalue_in_role.t, and t/lvalue_in_role_with_xs.t from MooX::LvalueAttribute as downstream coverage, then add focused unit tests for the Java-backed implementation. Done means supported modules load without native XS, with unsupported operations documented.

Written by the indexing model from the issue text.

Description

area:cpan-port enhancement

Summary

Port Variable::Magic to PerlOnJava or provide a compatible Java-backed implementation so CPAN modules that depend on Perl variable magic can load and run without native XS.

Variable::Magic exposes Perl's low-level variable-magic API, including callbacks for get, set, clear, free, copy, local, and hash fetch/store/exists/delete operations. The current distribution is XS-only and requires a C compiler; PerlOnJava reports:

Can't load loadable object for module Variable::Magic: no Java XS implementation available

CPAN evidence

In CPAN run 20260918-141920-96054, MooX::LvalueAttribute v0.16 passes completely under system Perl:

Files=6, Tests=33
Result: PASS

Under PerlOnJava, 4/6 test programs fail during loading because Variable::Magic cannot load. The affected downstream tests are:

  • t/00-compile.t
  • t/lvalue.t
  • t/lvalue_in_role.t
  • t/lvalue_in_role_with_xs.t

This prevents the lvalue-attribute implementation from exercising its normal behavior; the failure is in the native dependency rather than in MooX::LvalueAttribute itself.

Ecosystem impact

The current MetaCPAN release index contains 38 unique CPAN distributions with a runtime requires dependency on Variable::Magic, deduplicated across 634 matching release records. Two dependant distributions have releases within the preceding 12 months: Dios and MooseX-Params.

Representative runtime dependants include DBIx-Class, KiokuDB, MRO-Magic, MooX-LvalueAttribute, MooseX-Lexical-Types, MooseX-LvalueAttribute, Type-Alias, warnings-lock, and Variable-Temp.

Source query: https://fastapi.metacpan.org/v1/release/_search?q=dependency.module%3A%22Variable%3A%3AMagic%22&size=1000&from=0

Expected behavior

A supported PerlOnJava implementation should allow modules using the documented Variable::Magic API to load and provide compatible variable-magic behavior, or clearly expose a supported substitute that downstream CPAN modules can use without native code.

Suggested scope

  • Define the supported Variable::Magic API and identify which magic operations can be represented by PerlOnJava runtime hooks.
  • Implement the highest-value operations first, including wizard creation, casting, retrieving data, and dispelling magic.
  • Preserve callback timing and lvalue/hash behavior where the Perl runtime exposes an equivalent operation.
  • Add focused unit tests for the Java-backed implementation on both JVM and interpreter backends.
  • Use MooX::LvalueAttribute as downstream acceptance coverage, followed by other dependants such as MRO::Magic and warnings-lock.
  • Document unsupported operations explicitly if complete parity cannot be achieved in the first port.

Notes

This is a porting/enhancement request for a native CPAN dependency, not a defect in MooX::LvalueAttribute. The reverse-dependency lookup in the local CPAN-priority tool previously failed with MetaCPAN HTTP 599; the count above was independently obtained from the current MetaCPAN release index and filtered to unique runtime dependants.

Dominant language
Perl
Stars
64
Forks
6
Avg merge
5h 18m
Merged PRs (30d)
162

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from fglock/PerlOnJava

All issues in fglock/PerlOnJava

Similar issues

More Perl issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.