warn("opset_len %ld\n", (long)opset_len);
op_names_init(aTHX);
+void
+_safe_pkg_prep(Package)
+ char * Package
+PPCODE:
+ HV *hv;
+ ENTER;
+
+ hv = gv_stashpv(Package, GV_ADDWARN); /* should exist already */
+
+ if (strNE(HvNAME(hv),"main")) {
+ Safefree(HvNAME(hv));
+ HvNAME(hv) = savepv("main"); /* make it think it's in main:: */
+ hv_store(hv,"_",1,(SV *)PL_defgv,0); /* connect _ to global */
+ SvREFCNT_inc((SV *)PL_defgv); /* want to keep _ around! */
+ }
+ LEAVE;
+
+
+
+
void
_safe_call_sv(Package, mask, codesv)
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;
# the whole glob *_ rather than $_ and @_ separately, otherwise
# @_ in non default packages within the compartment don't work.
$obj->share_from('main', $default_share);
+ Opcode::_safe_pkg_prep($obj->{Root});
return $obj;
}