This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Cloning a format whose outside has been undefined
authorFather Chrysostomos <sprout@cpan.org>
Sat, 30 Jun 2012 19:43:26 +0000 (12:43 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sat, 30 Jun 2012 21:25:50 +0000 (14:25 -0700)
commit1fab8097422c9c5cc9be92cd5b4675b764b60545
tree559a9306fd561154cd1c6f8686b6417f53b1da9d
parentc4d8885704f2b112d66e7854f620cc3bf4c8ae37
Cloning a format whose outside has been undefined

This has crashed ever since 71f882da8, because the format tries to
close over a pad that does not exist:

sub x {
    {my ($a,$b,$c,$d,$e,$f,$g,$h,$i,$j,$k,$l,$m,$n,$o,$p,$q,$r,$s,$t,$u)}
    my $z;
    format =
@<<<
$z
.
}
undef &x;
write;

This commit adds checks for nonexistent pads, producing the â€˜Variable
is not available’ warning in cases like this.

(cherry-picked from f2ead8b)
pad.c
t/comp/form_scope.t