This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Stop recursion from losing lex fh names
sub r {
r($_[0]-1) if $_[0];
open my $fh, "/dev/null";
print "$_[0] $$fh\n"
}
r(5);
__END__
Output:
0 *main::
1 *main::
2 *main::
3 *main::
4 *main::
5 *main::$fh
The largest number represents the outermost call.
The handle name was being allocated as a target (a scratch variable
used by various operators to return values). Targets are not shared
between recursion levels.
This commit tells pad_alloc to treat it like a constant, so it
is shared.