Make PL_compcv visible to BEGIN blocks
authorFather Chrysostomos <sprout@cpan.org>
Wed, 26 Sep 2012 15:47:28 +0000 (08:47 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Wed, 26 Sep 2012 15:55:12 +0000 (08:55 -0700)
This allows BEGIN { XS_func(); } to access the currently-com-
piling pad.

BEGIN blocks were unlike any other subroutine or special block in that
PL_compcv would be set to the BEGIN block itself at run time.

op.c

diff --git a/op.c b/op.c
index d074c0c..dfc1cd7 100644 (file)
--- a/op.c
+++ b/op.c
@@ -7663,7 +7663,10 @@ Perl_newATTRSUB_flags(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs,
        }
 
        if (name && ! (PL_parser && PL_parser->error_count))
+       {
+           LEAVE_SCOPE(floor);
            process_special_blocks(name, gv, cv);
+       }
     }
 
   done: