p |UV |do_vecget |NN SV* sv|I32 offset|I32 size
p |void |do_vecset |NN SV* sv
p |void |do_vop |I32 optype|NN SV* sv|NN SV* left|NN SV* right
-p |OP* |dofile |NN OP* term
+p |OP* |dofile |NN OP* term|I32 force_builtin
ApR |I32 |dowantarray
Ap |void |dump_all
Ap |void |dump_eval
#define do_vecget(a,b,c) Perl_do_vecget(aTHX_ a,b,c)
#define do_vecset(a) Perl_do_vecset(aTHX_ a)
#define do_vop(a,b,c,d) Perl_do_vop(aTHX_ a,b,c,d)
-#define dofile(a) Perl_dofile(aTHX_ a)
+#define dofile(a,b) Perl_dofile(aTHX_ a,b)
#endif
#define dowantarray() Perl_dowantarray(aTHX)
#define dump_all() Perl_dump_all(aTHX)
}
OP *
-Perl_dofile(pTHX_ OP *term)
+Perl_dofile(pTHX_ OP *term, I32 force_builtin)
{
OP *doop;
- GV *gv;
+ GV *gv = Nullgv;
- gv = gv_fetchpv("do", FALSE, SVt_PVCV);
- if (!(gv && GvCVu(gv) && GvIMPORTED_CV(gv)))
- gv = gv_fetchpv("CORE::GLOBAL::do", FALSE, SVt_PVCV);
+ if (!force_builtin) {
+ gv = gv_fetchpv("do", FALSE, SVt_PVCV);
+ if (!(gv && GvCVu(gv) && GvIMPORTED_CV(gv))) {
+ GV **gvp = (GV**)hv_fetch(PL_globalstash, "do", 2, FALSE);
+ if (gvp) gv = *gvp; else gv = Nullgv;
+ }
+ }
if (gv && GvCVu(gv) && GvIMPORTED_CV(gv)) {
doop = ck_subr(newUNOP(OP_ENTERSUB, OPf_STACKED,
case 133:
#line 569 "perly.y"
- { (yyval.opval) = dofile((yyvsp[0].opval)); ;}
+ { (yyval.opval) = dofile((yyvsp[0].opval), (yyvsp[-1].ival)); ;}
break;
case 134:
/* Things called with "do" */
termdo : DO term %prec UNIOP /* do $filename */
- { $$ = dofile($2); }
+ { $$ = dofile($2, $1); }
| DO block %prec '(' /* do { code */
{ $$ = newUNOP(OP_NULL, OPf_SPECIAL, scope($2)); }
| DO WORD '(' ')' /* do somesub() */
__attribute__nonnull__(pTHX_3)
__attribute__nonnull__(pTHX_4);
-PERL_CALLCONV OP* Perl_dofile(pTHX_ OP* term)
+PERL_CALLCONV OP* Perl_dofile(pTHX_ OP* term, I32 force_builtin)
__attribute__nonnull__(pTHX_1);
PERL_CALLCONV I32 Perl_dowantarray(pTHX)
Perl_croak(aTHX_ "CORE::%s is not a keyword", PL_tokenbuf);
if (tmp < 0)
tmp = -tmp;
- else if (tmp == KEY_require)
+ else if (tmp == KEY_require || tmp == KEY_do)
/* that's a way to remember we saw "CORE::" */
- orig_keyword = KEY_require;
+ orig_keyword = tmp;
goto reserved_word;
}
goto just_a_word;
PRETERMBLOCK(DO);
if (*s != '\'')
s = force_word(s,WORD,TRUE,TRUE,FALSE);
+ if (orig_keyword == KEY_do) {
+ orig_keyword = 0;
+ yylval.ival = 1;
+ }
+ else
+ yylval.ival = 0;
OPERATOR(DO);
case KEY_die: