summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorChip Salzenberg <chip@pobox.com>2008-11-13 16:44:36 -0800
committerH.Merijn Brand <h.m.brand@xs4all.nl>2008-11-14 12:37:01 +0000
commite23d9e2f39425eea292ee5999c974fdc2cdd98b8 (patch)
treedfc9224eeb4048f96a454d8554932ff0ea226d95 /pp_hot.c
parentfc8f615e0f1bfc61d321240c5d49d61e3e6f6939 (diff)
downloadperl-e23d9e2f39425eea292ee5999c974fdc2cdd98b8.tar.gz
[perl #948] [PATCH] Allow tied $,
Message-ID: <20081114084436.GJ5779@tytlal.topaz.cx> p4raw-id: //depot/perl@34831
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/pp_hot.c b/pp_hot.c
index e22502f6ff..a60a176750 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -753,14 +753,16 @@ PP(pp_print)
goto just_say_no;
}
else {
+ SV * const ofs = GvSV(PL_ofsgv); /* $, */
MARK++;
- if (PL_ofs_sv && SvOK(PL_ofs_sv)) {
+ if (ofs && (SvGMAGICAL(ofs) || SvOK(ofs))) {
while (MARK <= SP) {
if (!do_print(*MARK, fp))
break;
MARK++;
if (MARK <= SP) {
- if (!do_print(PL_ofs_sv, fp)) { /* $, */
+ /* don't use 'ofs' here - it may be invalidated by magic callbacks */
+ if (!do_print(GvSV(PL_ofsgv), fp)) {
MARK--;
break;
}