Skip to content

Instantly share code, notes, and snippets.

@hkoba
Last active December 3, 2025 04:23
Show Gist options
  • Select an option

  • Save hkoba/68ed343feb815ff125049453c685fb2d to your computer and use it in GitHub Desktop.

Select an option

Save hkoba/68ed343feb815ff125049453c685fb2d to your computer and use it in GitHub Desktop.
Stash entry type ambiguity in perl5.43.2-5
#!/usr/bin/env perl
use strict;
use warnings;
use Test2::V0 -no_srand => 1;
{
package
MyTestPackage001;
sub foo {"foo"}
}
{
my $stash = \%MyTestPackage001::;
is ref $stash->{foo}, ''
, q{ref $MyTestPackage001::{foo} is not a ref};
is ref \$stash->{foo}, 'GLOB'
, q{ref $MyTestPackage001::{foo} should be GLOB};
}
eval q{
my $stash = \%MyTestPackage001::;
is $stash->{foo}, *MyTestPackage001::foo, "touch the glob";
is ref $stash->{foo}, ''
, q{ref $MyTestPackage001::{foo} is not a ref};
is ref \$stash->{foo}, 'GLOB'
, q{ref $MyTestPackage001::{foo} should be GLOB};
};
done_testing;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment