summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-03-09 17:39:58 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-03-09 17:39:58 +0000
commit16fe6d5906f6eff9da00cb861a7054a440d1f6eb (patch)
treef3ff2ac74f436b26fa347b78d5a7c2cb63206bd6 /op.c
parent023ceb80f0d82032a841fbab1bfd1282af1def7b (diff)
downloadperl-16fe6d5906f6eff9da00cb861a7054a440d1f6eb.tar.gz
support binmode(F,":crlf") and use open IN => ":raw", OUT => ":crlf"
semantics; the pragma sets defaults for both open() and qx// p4raw-id: //depot/perl@5628
Diffstat (limited to 'op.c')
-rw-r--r--op.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/op.c b/op.c
index 19be53507e..cb25f23749 100644
--- a/op.c
+++ b/op.c
@@ -5836,6 +5836,36 @@ Perl_ck_null(pTHX_ OP *o)
}
OP *
+Perl_ck_open(pTHX_ OP *o)
+{
+ HV *table = GvHV(PL_hintgv);
+ if (table) {
+ SV **svp;
+ I32 mode;
+ svp = hv_fetch(table, "open_IN", 7, FALSE);
+ if (svp && *svp) {
+ mode = mode_from_discipline(*svp);
+ if (mode & O_BINARY)
+ o->op_private |= OPpOPEN_IN_RAW;
+ else if (mode & O_TEXT)
+ o->op_private |= OPpOPEN_IN_CRLF;
+ }
+
+ svp = hv_fetch(table, "open_OUT", 8, FALSE);
+ if (svp && *svp) {
+ mode = mode_from_discipline(*svp);
+ if (mode & O_BINARY)
+ o->op_private |= OPpOPEN_OUT_RAW;
+ else if (mode & O_TEXT)
+ o->op_private |= OPpOPEN_OUT_CRLF;
+ }
+ }
+ if (o->op_type == OP_BACKTICK)
+ return o;
+ return ck_fun(o);
+}
+
+OP *
Perl_ck_repeat(pTHX_ OP *o)
{
if (cBINOPo->op_first->op_flags & OPf_PARENS) {