if (multi)
GvMULTI_on(gv);
if (doproto) { /* Replicate part of newSUB here. */
+ SvIOK_off(gv);
ENTER;
start_subparse(0,0); /* Create CV in compcv. */
GvCV(gv) = compcv;
}
}
-static void
+STATIC void
gv_init_sv(GV *gv, I32 sv_type)
{
switch (sv_type) {
len = namend - name;
if (len > 0) {
+ char smallbuf[256];
char *tmpbuf;
- char autobuf[64];
- if (len < sizeof(autobuf) - 2)
- tmpbuf = autobuf;
+ if (len + 3 < sizeof smallbuf)
+ tmpbuf = smallbuf;
else
New(601, tmpbuf, len+3, char);
Copy(name, tmpbuf, len, char);
else
GvMULTI_on(gv);
}
- if (tmpbuf != autobuf)
+ if (tmpbuf != smallbuf)
Safefree(tmpbuf);
if (!gv || gv == (GV*)&sv_undef)
return Nullgv;
#endif
goto magicalize;
+ case '!':
+ if (len > 1)
+ break;
+ if (sv_type > SVt_PV && curcop != &compiling) {
+ HV* stash = gv_stashpvn("Errno",5,FALSE);
+ if(!stash || !(gv_fetchmethod(stash, "TIEHASH"))) {
+ dSP;
+ PUTBACK;
+ perl_require_pv("Errno.pm");
+ SPAGAIN;
+ stash = gv_stashpvn("Errno",5,FALSE);
+ if (!stash || !(gv_fetchmethod(stash, "TIEHASH")))
+ croak("Can't use %%! because Errno.pm is not available");
+ }
+ }
+ goto magicalize;
case '#':
case '*':
if (dowarn && len == 1 && sv_type == SVt_PV)
warn("Use of $%s is deprecated", name);
/* FALL THROUGH */
case '[':
- case '!':
case '^':
case '~':
case '=':
break;
case copy_amg:
{
- SV* ref=SvRV(left);
- if (!SvROK(ref) && SvTYPE(ref) <= SVt_PVMG) {
+ /*
+ * SV* ref causes confusion with the interpreter variable of
+ * the same name
+ */
+ SV* tmpRef=SvRV(left);
+ if (!SvROK(tmpRef) && SvTYPE(tmpRef) <= SVt_PVMG) {
/*
* Just to be extra cautious. Maybe in some
* additional cases sv_setsv is safe, too.
*/
- SV* newref = newSVsv(ref);
+ SV* newref = newSVsv(tmpRef);
SvOBJECT_on(newref);
- SvSTASH(newref) = (HV*)SvREFCNT_inc(SvSTASH(ref));
+ SvSTASH(newref) = (HV*)SvREFCNT_inc(SvSTASH(tmpRef));
return newref;
}
}
PUTBACK;
if (op = pp_entersub(ARGS))
- runops();
+ CALLRUNOPS();
LEAVE;
SPAGAIN;