This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Use the same outside logic for mysubs and formats
authorFather Chrysostomos <sprout@cpan.org>
Fri, 7 Sep 2012 03:32:47 +0000 (20:32 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 16 Sep 2012 05:45:08 +0000 (22:45 -0700)
commitebfebee40d0932ec522c6781a1405d871fab3ca1
treee20c37cc4ccd4f4259458c00f76cde82d447d3f5
parentcf748c3cf2f8037fd170d42f370bc36a48de92ad
Use the same outside logic for mysubs and formats

By using find_runcv_where both for formats and my subs nested in inner
clonable subs, we can simplify the code.

It happens to make this work ($x is visible):

use 5.01;
sub not_lexical8 {
  my sub foo;
  foo();
  sub not_lexical9 {
    my sub bar {
      my $x = 'khaki car keys for the khaki car';
      not_lexical8();
      sub foo { warn $x }
    }
    bar()
  }
}
not_lexical9();

This is definitely iffy code, but if making it work makes the imple-
mentation simpler, so why not?
pad.c
t/cmd/lexsub.t