diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2005-09-26 14:04:21 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2005-09-26 14:04:21 +0000 |
commit | a72a1c8b669f627c80c2fa5d710eb7980a143476 (patch) | |
tree | 2fe0a5115982a725a716eb6ec15b5aea105577a6 /op.c | |
parent | 204b4d7f800e266ce239f9e434271307a9c45b3e (diff) | |
download | perl-a72a1c8b669f627c80c2fa5d710eb7980a143476.tar.gz |
CORE::require was always parsed as require().
That's because require() isn't overridable at tokenizer-level
like other overridable built-ins, but is handled by the optree
builder. So, find a way to pass the information that require()
was written as CORE::require() to Perl_ck_require. This is
done by adding a new token type REQUIRE and by adding OPf_SPECIAL
to OP_REQUIRE when it's saw as CORE::require in the program text.
This fixes bug [perl #37274] The "CORE" in CORE::require is ignored.
p4raw-id: //depot/perl@25599
Diffstat (limited to 'op.c')
-rw-r--r-- | op.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -5923,7 +5923,7 @@ Perl_ck_repeat(pTHX_ OP *o) OP * Perl_ck_require(pTHX_ OP *o) { - GV* gv; + GV* gv = Nullgv; if (o->op_flags & OPf_KIDS) { /* Shall we supply missing .pm? */ SVOP *kid = (SVOP*)cUNOPo->op_first; @@ -5955,10 +5955,12 @@ Perl_ck_require(pTHX_ OP *o) } } - /* handle override, if any */ - gv = gv_fetchpv("require", FALSE, SVt_PVCV); - if (!(gv && GvCVu(gv) && GvIMPORTED_CV(gv))) - gv = gv_fetchpv("CORE::GLOBAL::require", FALSE, SVt_PVCV); + if (!(o->op_flags & OPf_SPECIAL)) { /* Wasn't written as CORE::require */ + /* handle override, if any */ + gv = gv_fetchpv("require", FALSE, SVt_PVCV); + if (!(gv && GvCVu(gv) && GvIMPORTED_CV(gv))) + gv = gv_fetchpv("CORE::GLOBAL::require", FALSE, SVt_PVCV); + } if (gv && GvCVu(gv) && GvIMPORTED_CV(gv)) { OP *kid = cUNOPo->op_first; |