diff options
author | Yitzchak Scott-Thoennes <sthoenna@efn.org> | 2002-03-04 08:24:32 -0800 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2002-03-06 00:34:32 +0000 |
commit | 4e3399f9b267135d193509ba5240514af04e9fec (patch) | |
tree | e1cbf712891072ead87a2bc38d7f8dcdfc112774 /pp_ctl.c | |
parent | fa09c185cf93a599dc0290b9ee4ba0149df70363 (diff) | |
download | perl-4e3399f9b267135d193509ba5240514af04e9fec.tar.gz |
Re: [PATCH] Re: [ID 20000922.001] Implicit comparison to $. not performed before filehandle read
Message-ID: <ABBh8gzkgezX092yn@efn.org>
p4raw-id: //depot/perl@15054
Diffstat (limited to 'pp_ctl.c')
-rw-r--r-- | pp_ctl.c | 33 |
1 files changed, 24 insertions, 9 deletions
@@ -896,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); } @@ -980,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"); } |