X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pp_ctl.c;h=81a96de1c40aa77cbcfa6bef9b5d80090a1726b8;hb=95036ac7ba8f6d5403ad0ee3cd45c1e0d1312ad7;hp=14a48c653ddb72eaa99cec35d34b525da03efa50;hpb=8e0fc1cdff8c4d07f11a5b0bd5056e1acbe2a68a;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pp_ctl.c b/pp_ctl.c index 14a48c6..81a96de 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -158,6 +158,7 @@ PP(pp_substcont) register REGEXP *rx = cx->sb_rx; rxres_restore(&cx->sb_rxres, rx); + PL_reg_match_utf8 = SvUTF8(cx->sb_targ) ? 1 : 0; if (cx->sb_iters++) { I32 saviters = cx->sb_iters; @@ -895,13 +896,16 @@ PP(pp_flip) else { dTOPss; SV *targ = PAD_SV(PL_op->op_targ); - int flip; + int flip = 0; if (PL_op->op_private & OPpFLIP_LINENUM) { - struct io *gp_io; - flip = PL_last_in_gv - && (gp_io = GvIO(PL_last_in_gv)) - && SvIV(sv) == (IV)IoLINES(gp_io); + if (GvIO(PL_last_in_gv)) { + flip = SvIV(sv) == (IV)IoLINES(GvIOp(PL_last_in_gv)); + } + else { + GV *gv = gv_fetchpv(".", TRUE, SVt_PV); + if (gv && GvSV(gv)) flip = SvIV(sv) == SvIV(GvSV(gv)); + } } else { flip = SvTRUE(sv); } @@ -979,11 +983,23 @@ PP(pp_flop) else { dTOPss; SV *targ = PAD_SV(cUNOP->op_first->op_targ); + int flop = 0; sv_inc(targ); - if ((PL_op->op_private & OPpFLIP_LINENUM) - ? (GvIO(PL_last_in_gv) - && SvIV(sv) == (IV)IoLINES(GvIOp(PL_last_in_gv))) - : SvTRUE(sv) ) { + + if (PL_op->op_private & OPpFLIP_LINENUM) { + if (GvIO(PL_last_in_gv)) { + flop = SvIV(sv) == (IV)IoLINES(GvIOp(PL_last_in_gv)); + } + else { + GV *gv = gv_fetchpv(".", TRUE, SVt_PV); + if (gv && GvSV(gv)) flop = SvIV(sv) == SvIV(GvSV(gv)); + } + } + else { + flop = SvTRUE(sv); + } + + if (flop) { sv_setiv(PAD_SV(((UNOP*)cUNOP->op_first)->op_first->op_targ), 0); sv_catpv(targ, "E0"); } @@ -2870,7 +2886,7 @@ PP(pp_require) OP *op; sv = POPs; - if (SvNIOKp(sv)) { + if (SvNIOKp(sv) && PL_op->op_type != OP_DOFILE) { if (SvPOK(sv) && SvNOK(sv) && SvNV(sv)) { /* require v5.6.1 */ UV rev = 0, ver = 0, sver = 0; STRLEN len;