diff options
author | Abhijit Menon-Sen <ams@wiw.org> | 2001-08-12 21:38:06 +0530 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-08-12 13:42:03 +0000 |
commit | 5b468f54a26b6cc5b994509b89b4ae0df54ab101 (patch) | |
tree | cc0f4de7e363e5ce0ab9917ce11e032f08061e47 /pp_hot.c | |
parent | 169da83847a2059e4bc997fdd0d3f1afb5af3a3f (diff) | |
download | perl-5b468f54a26b6cc5b994509b89b4ae0df54ab101.tar.gz |
Re: Can't localize *FH, then tie it
Message-ID: <20010812160806.A28712@lustre.dyn.wiw.org>
p4raw-id: //depot/perl@11639
Diffstat (limited to 'pp_hot.c')
-rw-r--r-- | pp_hot.c | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -558,7 +558,10 @@ PP(pp_print) gv = (GV*)*++MARK; else gv = PL_defoutgv; - if ((mg = SvTIED_mg((SV*)gv, PERL_MAGIC_tiedscalar))) { + + if (gv && (io = GvIO(gv)) + && (mg = SvTIED_mg((SV*)io, PERL_MAGIC_tiedscalar))) + { had_magic: if (MARK == ORIGMARK) { /* If using default handle then we need to make space to @@ -570,7 +573,7 @@ PP(pp_print) ++SP; } PUSHMARK(MARK - 1); - *MARK = SvTIED_obj((SV*)gv, mg); + *MARK = SvTIED_obj((SV*)io, mg); PUTBACK; ENTER; call_method("PRINT", G_SCALAR); @@ -582,8 +585,8 @@ PP(pp_print) RETURN; } if (!(io = GvIO(gv))) { - if ((GvEGV(gv)) - && (mg = SvTIED_mg((SV*)GvEGV(gv), PERL_MAGIC_tiedscalar))) + if ((GvEGV(gv)) && (io = GvIO(GvEGV(gv))) + && (mg = SvTIED_mg((SV*)io, PERL_MAGIC_tiedscalar))) goto had_magic; if (ckWARN2(WARN_UNOPENED,WARN_CLOSED)) report_evil_fh(gv, io, PL_op->op_type); @@ -1434,9 +1437,9 @@ Perl_do_readline(pTHX) I32 gimme = GIMME_V; MAGIC *mg; - if ((mg = SvTIED_mg((SV*)PL_last_in_gv, PERL_MAGIC_tiedscalar))) { + if (io && (mg = SvTIED_mg((SV*)io, PERL_MAGIC_tiedscalar))) { PUSHMARK(SP); - XPUSHs(SvTIED_obj((SV*)PL_last_in_gv, mg)); + XPUSHs(SvTIED_obj((SV*)io, mg)); PUTBACK; ENTER; call_method("READLINE", gimme); |