Fix package-stash copy losing methods in Class::Hook
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 65/100
Piste de recherche
The issue identifies package stash/typeglob assignment and method dispatch as the entry points; start by tracing %{"FOO::"} = %saved through both JVM and interpreter backends. Add the focused project-owned regression described in the issue, validate it against system Perl, and run it on both backends. Done means the blessed value is returned and unchanged Class-Hook 0.06 t/original.t passes.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Summary
PerlOnJava loses a package method after a package stash is copied back through
the standard typeglob/stash assignment pattern. This breaks the pure-Perl
Class::Hook distribution: its hook restores a saved class namespace and then
calls FOO->new, but the call returns undef rather than the blessed FOO
object returned by standard Perl.
The failure reproduces on both execution backends. It is a shared runtime
compatibility defect in package stash/typeglob handling or in method dispatch
after that mutation, not a dependency, XS, service, display, or timeout issue.
CPAN evidence
- CPAN random tester run:
20260925-103132-20451 - Distribution:
Class-Hook0.06 - Failing upstream test:
t/original.t - PerlOnJava result: 2 of 5 executed subtests fail, then the test aborts with
Can't call method "bar" on an undefined value; its plan is 11 tests. - Both JVM and interpreter backends reproduce the same result.
The unmodified upstream suite passes under the system-Perl oracle:
t/original.t .. ok
All tests successful.
Files=1, Tests=11
Result: PASS
Class::Hook is pure Perl, so no native-module port or reverse-dependency
qualification is involved.
Failing upstream pattern
Class::Hook dynamically loads a class, snapshots its namespace, restores the
saved namespace before dispatch, then removes it again so later calls route
through UNIVERSAL::AUTOLOAD. Its relevant pattern is:
no strict 'refs';
require FOO;
my %saved = %{"FOO::"};
%{"FOO::"} = %saved;
my $object = FOO->new({});
FOO::new is an ordinary Perl subroutine which blesses and returns a hash
reference. Standard Perl retains the method and returns a FOO object.
Minimal reproducer
The following is self-contained apart from a FOO.pm defining an ordinary
FOO::new constructor:
no strict 'refs';
require FOO;
my %saved = %{"FOO::"};
%{"FOO::"} = %saved;
my $object = FOO->new({});
print defined($object) ? ref($object) : "undef", "\n";
Expected with system Perl:
FOO
Actual with PerlOnJava JVM backend:
undef
Actual with PerlOnJava interpreter backend:
undef
Expected behavior
Assigning a saved package stash back through %{"FOO::"} = %saved must retain
the effective CODE slots for later method lookup. FOO->new({}) must invoke
FOO::new and return its blessed object, matching Perl.
The implementation should preserve normal typeglob slot semantics rather than
special-casing Class::Hook; callers may use this pattern for methods, package
variables, and other glob-backed namespace entries.
Related issues
- #1305 is related typeglob work but is not a duplicate: it covers compilation
and dynamic-scope restoration forlocal *$globref; this issue covers runtime
method loss after a package-stash hash copy. - #1473's false
CORE::try/CORE::catchwarnings appear during the test run,
but do not cause this failure.
Regression coverage
Add a project-owned focused, system-Perl-validated regression test covering:
- A package with a normal constructor or named method.
- Snapshotting its stash with
%saved = %{"Package::"}. - Restoring it with
%{"Package::"} = %saved. - Successful class-method dispatch after restoration, including the returned
blessed value. - JVM and interpreter backend parity.
After the focused test passes, rerun Class-Hook 0.06's unchanged t/original.t
as integration coverage.
- Langage dominant
- Perl
- Étoiles
- 65
- Forks
- 8
- Merge moyen
- 5 h 56 min
- PR mergées (30 j)
- 184
Préparer son environnement
- Fournit un Dockerfile ou un fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de fglock/PerlOnJava
-
area:runtime documentation enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
fglock/PerlOnJava#1579 ·
Les mainteneurs répondent en général sous 1 jour
-
Port Devel::Size for PerlOnJavaOuvertearea:cpan-port enhancement help wanted
Difficulté 4/5 3-5 jours Accessibilité débutants 45/100
fglock/PerlOnJava#1880 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
perf: achieve measured 1:1 standard Perl throughput after #1850Peut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. Ouvertearea:performance enhancement
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 20/100
fglock/PerlOnJava#1863 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
area:memory area:performance area:runtime bug
Difficulté 4/5 3-5 jours Accessibilité débutants 52/100
fglock/PerlOnJava#1860 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
area:performance enhancement
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
fglock/PerlOnJava#1846 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de fglock/PerlOnJava
Issues similaires
-
✏️ Editing - Tags
Difficulté 2/5 1-3 heures Accessibilité débutants 66/100
openfoodfacts/openfoodfacts-server#15127 ·
Les mainteneurs répondent en général sous 1 jour
-
FIDO2 (ecdsa-sk / ed25519-sk) ingress keys rejected: missing in get_supported_ssh_algorithms_listOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
ovh/the-bastion#695 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
darold/pgFormatter#425 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
-
observablt-ci
Difficulté 2/5 1-3 heures Accessibilité débutants 86/100
elastic/golang-crossbuild#840 ·
Les mainteneurs répondent en général sous 1 jour