curstash = defstash;
compiling.cop_stash = defstash;
debstash = GvHV(gv_fetchpv("DB::", GV_ADDMULTI, SVt_PVHV));
+ globalstash = GvHV(gv_fetchpv("CORE::GLOBAL::", GV_ADDMULTI, SVt_PVHV));
/* We must init $/ before switches are processed. */
sv_setpvn(GvSV(gv_fetchpv("/", TRUE, SVt_PV)), "\n", 1);
}
IEXT HV * Idefstash; /* main symbol table */
IEXT HV * Icurstash; /* symbol table for current package */
IEXT HV * Idebstash; /* symbol table for perldb package */
+IEXT HV * Iglobalstash; /* global keyword overrides imported here */
IEXT SV * Icurstname; /* name of current package */
IEXT AV * Ibeginav; /* names of BEGIN subroutines */
IEXT AV * Iendav; /* names of END subroutines */
case 'y': case 'Y':
case 'z': case 'Z':
- keylookup:
+ keylookup: {
+ GV *gv = Nullgv;
+ GV **gvp = 0;
+
bufptr = s;
s = scan_word(s, tokenbuf, sizeof tokenbuf, FALSE, &len);
}
if (tmp < 0) { /* second-class keyword? */
- GV* gv;
- if (expect != XOPERATOR &&
- (*s != ':' || s[1] != ':') &&
- (gv = gv_fetchpv(tokenbuf, FALSE, SVt_PVCV)) &&
- GvIMPORTED_CV(gv))
+ if (expect != XOPERATOR && (*s != ':' || s[1] != ':') &&
+ (((gv = gv_fetchpv(tokenbuf, FALSE, SVt_PVCV)) &&
+ GvCVu(gv) && GvIMPORTED_CV(gv)) ||
+ ((gvp = (GV**)hv_fetch(globalstash,tokenbuf,len,FALSE)) &&
+ (gv = *gvp) != (GV*)&sv_undef &&
+ GvCVu(gv) && GvIMPORTED_CV(gv))))
{
tmp = 0;
}
- else
- tmp = -tmp;
+ else {
+ tmp = -tmp; gv = Nullgv; gvp = 0;
+ }
}
reserved_word:
default: /* not a keyword */
just_a_word: {
- GV *gv;
SV *sv;
char lastchar = (bufptr == oldoldbufptr ? 0 : bufptr[-1]);
/* Look for a subroutine with this name in current package. */
- gv = gv_fetchpv(tokenbuf,FALSE, SVt_PVCV);
+ if (gvp) {
+ sv = newSVpv("CORE::GLOBAL::",14);
+ sv_catpv(sv,tokenbuf);
+ }
+ else
+ sv = newSVpv(tokenbuf,0);
+ if (!gv)
+ gv = gv_fetchpv(tokenbuf,FALSE, SVt_PVCV);
/* Presume this is going to be a bareword of some sort. */
CLINE;
- yylval.opval = (OP*)newSVOP(OP_CONST, 0, newSVpv(tokenbuf,0));
+ yylval.opval = (OP*)newSVOP(OP_CONST, 0, sv);
yylval.opval->op_private = OPpCONST_BARE;
/* See if it's the indirect object for a list operator. */
s = scan_trans(s);
TERM(sublex_start());
}
- }
+ }}
}
I32