summaryrefslogtreecommitdiff
path: root/ext/Opcode
diff options
context:
space:
mode:
authorCharles Lane <lane@DUPHY4.Physics.Drexel.Edu>2000-12-14 15:04:42 -0500
committerJarkko Hietaniemi <jhi@iki.fi>2000-12-15 15:19:34 +0000
commitd86ca223b7bea516175c99c61fc271cc462a2de7 (patch)
tree7da56509d985d8a03899109c65c4cd336a7551d3 /ext/Opcode
parentf168a5e7e53f96f3b52398f0f6fcaaf6eda02875 (diff)
downloadperl-d86ca223b7bea516175c99c61fc271cc462a2de7.tar.gz
stuff for caller and _ in Safe::
Message-Id: <001214200310.49929@DUPHY4.Physics.Drexel.Edu> p4raw-id: //depot/perl@8127
Diffstat (limited to 'ext/Opcode')
-rw-r--r--ext/Opcode/Opcode.xs6
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/Opcode/Opcode.xs b/ext/Opcode/Opcode.xs
index e191ec7c9c..04f7c3fa33 100644
--- a/ext/Opcode/Opcode.xs
+++ b/ext/Opcode/Opcode.xs
@@ -253,6 +253,12 @@ PPCODE:
save_hptr(&PL_defstash); /* save current default stash */
/* the assignment to global defstash changes our sense of 'main' */
PL_defstash = gv_stashpv(Package, GV_ADDWARN); /* should exist already */
+ if (strNE(HvNAME(PL_defstash),"main")) {
+ Safefree(HvNAME(PL_defstash));
+ HvNAME(PL_defstash) = savepv("main"); /* make it think it's in main:: */
+ hv_store(PL_defstash,"_",1,(SV *)PL_defgv,0); /* connect _ to global */
+ SvREFCNT_inc((SV *)PL_defgv); /* want to keep _ around! */
+ }
save_hptr(&PL_curstash);
PL_curstash = PL_defstash;