summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2003-04-09 12:39:35 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2003-04-09 12:39:35 +0000
commit3b82e551af39ddf336fbbcdb868f3bb50618183d (patch)
tree85ea1ca8ee1b9860a969302ec96a49aff890e833 /op.c
parent0c4b0a3f6df5172b70e3383e7419936faa3fc0a0 (diff)
downloadperl-3b82e551af39ddf336fbbcdb868f3bb50618183d.tar.gz
open(my $fh, ">&", STDOUT) should not warn under strict.
p4raw-id: //depot/perl@19173
Diffstat (limited to 'op.c')
-rw-r--r--op.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/op.c b/op.c
index 40fbec197f..5ccb73d8f5 100644
--- a/op.c
+++ b/op.c
@@ -5499,6 +5499,25 @@ Perl_ck_open(pTHX_ OP *o)
}
if (o->op_type == OP_BACKTICK)
return o;
+ {
+ /* In case of three-arg dup open remove strictness
+ * from the last arg if it is a bareword. */
+ OP *first = cLISTOPx(o)->op_first; /* The pushmark. */
+ OP *last = cLISTOPx(o)->op_last; /* The bareword. */
+ OP *oa;
+ char *mode;
+
+ if ((last->op_type == OP_CONST) && /* The bareword. */
+ (last->op_private & OPpCONST_BARE) &&
+ (last->op_private & OPpCONST_STRICT) &&
+ (oa = first->op_sibling) && /* The fh. */
+ (oa = oa->op_sibling) && /* The mode. */
+ SvPOK(((SVOP*)oa)->op_sv) &&
+ (mode = SvPVX(((SVOP*)oa)->op_sv)) &&
+ mode[0] == '>' && mode[1] == '&' && /* A dup open. */
+ (last == oa->op_sibling)) /* The bareword. */
+ last->op_private &= ~OPpCONST_STRICT;
+ }
return ck_fun(o);
}