Skip to content

Keep stash CODE globs callable after each/list assignment #1963

Closed

Description

@fglock

Summary

Copying CODE globs out of a package stash with each %stash and a list assignment can leave the copied CV non-callable on PerlOnJava. DDC::Any::mapstash uses this pattern while exporting the pure-Perl DDC::PP backend.

Reproducer

package Example::PP;
our @Names = qw(First Second);
our %Values = (First => 1, Second => 2);
for my $name (@Names) {
    no strict 'refs';
    *{$name} = sub { $Values{$name} };
}
package main;
my $source = \%{'Example::PP::'};
my $destination = \%{'Example::Any::'};
while (my ($name, $glob) = each %$source) {
    $destination->{$name} = $glob;
}
print Example::Any::First();

System Perl prints 1; PerlOnJava returns undef. Looking up each value directly with keys %$source works, which narrows the issue to the stash-entry path through each and list assignment.

CPAN evidence

  • Distribution: DDC::Concordance 0.50, pure Perl; optional DDC::XS tests were skipped.
  • CPAN random-tester run: 20261103-123832-91742; record DDC::Any from DDC::Concordance.
  • System Perl: all 471 suite tests pass.
  • PerlOnJava JVM and interpreter: 62/452 subtests fail in t/10b_any_import_pp.t, t/11_any_constants.t, t/12_any_compiler.t, t/14_any_qcount.t, and t/15_any_qfilter.t.
  • Prerequisites NetServer::Generic 1.03 and Parse::Yapp were installed in the archived run; no native library, service, or platform prerequisite explains the failure.

Environment: macOS arm64, Java 24.0.2. The project regression will cover both PerlOnJava backends.

Activity

  1. added
    bugSomething isn't working
    area:runtimeCore Perl runtime semantics
    on Nov 4, 2026
  2. fglock commented on Nov 4, 2026

    @fglock
    OwnerAuthor

    State: complete
    Agent/session: codex-20261104-stash-each-cv
    Scope: #1963, preserve callable CODE slots, captured values and glob identity when stash values returned by each are assigned to another stash.
    Delivered: PR #1966 merged to master as 58e8b2eee3967dce5a0aaab00191a9dc9acf2de2 on 2026-11-04. Issue #1963 is closed.
    Evidence: Windows and Ubuntu CI passed on PR head 14fd93be4cd; full nice -n 19 make passed on the rebased source; the eval-based regression passed system Perl and PerlOnJava JVM/interpreter (9/9 each); full DDC::Concordance 0.50 suite passed on JVM (471 tests, 2 skipped), and all five affected files passed on interpreter. make check-links passed.

  3. added a commit that references this issue on Nov 4, 2026
    d70b88e
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

    area:runtimeCore Perl runtime semanticsbugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions