summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorAbhijit Menon-Sen <ams@wiw.org>2001-08-12 21:38:06 +0530
committerJarkko Hietaniemi <jhi@iki.fi>2001-08-12 13:42:03 +0000
commit5b468f54a26b6cc5b994509b89b4ae0df54ab101 (patch)
treecc0f4de7e363e5ce0ab9917ce11e032f08061e47 /pp_hot.c
parent169da83847a2059e4bc997fdd0d3f1afb5af3a3f (diff)
downloadperl-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.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/pp_hot.c b/pp_hot.c
index c801c2131e..db4c3fbb6e 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -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);