sub.t: To-do test for recursive shared-hash-keys TARGs
This is only buggy under ithreads.
sub a {
for (${\""}.${\""}) {
$_ = $_[0] || __PACKAGE__;
print "$_\n";
a("road") unless $_[0];
print "$_\n";
}
}
a();
The outer call sets the scalar returned by ${\""}.${\""} to the cur-
rent package name.
The inner call sets it to "road".
Each call prints it twice, the outer call surrounding the inner call.
The output in 5.10-5.18 is:
main
road
road
road
because the inner call is clobbering the same scalar. If __PACKAGE__
is changed to "main", it works, and prints
main
road
road
main
(as the script above also prints in 5.8.8).