diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2000-03-09 17:39:58 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2000-03-09 17:39:58 +0000 |
commit | 16fe6d5906f6eff9da00cb861a7054a440d1f6eb (patch) | |
tree | f3ff2ac74f436b26fa347b78d5a7c2cb63206bd6 /pp_sys.c | |
parent | 023ceb80f0d82032a841fbab1bfd1282af1def7b (diff) | |
download | perl-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 'pp_sys.c')
-rw-r--r-- | pp_sys.c | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -304,9 +304,14 @@ PP(pp_backtick) STRLEN n_a; char *tmps = POPpx; I32 gimme = GIMME_V; + char *mode = "r"; TAINT_PROPER("``"); - fp = PerlProc_popen(tmps, "r"); + if (PL_op->op_private & OPpOPEN_IN_RAW) + mode = "rb"; + else if (PL_op->op_private & OPpOPEN_IN_CRLF) + mode = "rt"; + fp = PerlProc_popen(tmps, mode); if (fp) { if (gimme == G_VOID) { char tmpbuf[256]; @@ -687,15 +692,20 @@ PP(pp_binmode) IO *io; PerlIO *fp; MAGIC *mg; + SV *discp = Nullsv; if (MAXARG < 1) RETPUSHUNDEF; + if (MAXARG > 1) + discp = POPs; gv = (GV*)POPs; if (gv && (mg = SvTIED_mg((SV*)gv, 'q'))) { PUSHMARK(SP); XPUSHs(SvTIED_obj((SV*)gv, mg)); + if (discp) + XPUSHs(discp); PUTBACK; ENTER; call_method("BINMODE", G_SCALAR); @@ -708,13 +718,12 @@ PP(pp_binmode) if (!(io = GvIO(gv)) || !(fp = IoIFP(io))) RETPUSHUNDEF; - if (do_binmode(fp,IoTYPE(io),TRUE)) + if (do_binmode(fp,IoTYPE(io),mode_from_discipline(discp))) RETPUSHYES; else RETPUSHUNDEF; } - PP(pp_tie) { djSP; |