This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix subroutine unavailability during cloning
authorFather Chrysostomos <sprout@cpan.org>
Fri, 7 Sep 2012 01:05:35 +0000 (18:05 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 16 Sep 2012 05:45:07 +0000 (22:45 -0700)
commitcf748c3cf2f8037fd170d42f370bc36a48de92ad
treea3fbd1ed65c6c77329d4e1d840dbb0401be6ccab
parent4e85e1b4de5848696dc021f24d071090d387fe70
Fix subroutine unavailability during cloning

sub foo {
  my $x;
  format =
@
$x||'#'
.
}
write;
__END__
Variable "$x" is not available at - line 9.

That one’s OK.

sub foo {
  my sub x {};
  format =
@
&x
.
}
write;
__END__
Variable "&x" is not available at - line 9.
Assertion failed: (SvTYPE(_svmagic) >= SVt_PVMG), function S_mg_findext_flags, file mg.c, line 404.
Abort trap

That should say ‘Subroutine’.  And it shouldn’t crash.

The my-sub-cloning code was not taking this case into account.  The
value in the proto pad is an undef scalar.
pad.c
t/cmd/lexsub.t