From 3eb568f1c9e22faaefbd6531878f947fab30705b Mon Sep 17 00:00:00 2001 From: Nick Ing-Simmons Date: Thu, 6 May 1999 21:44:38 +0000 Subject: open(FH,undef) # creates new_tmpfile opened read/write Add t/io/open.t with test for above. p4raw-id: //depot/perl@3315 --- pp_sys.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'pp_sys.c') diff --git a/pp_sys.c b/pp_sys.c index 45eee0b698..3f4a112276 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -506,6 +506,18 @@ PP(pp_open) DIE(PL_no_usym, "filehandle"); if (GvIOp(gv)) IoFLAGS(GvIOp(gv)) &= ~IOf_UNTAINT; + if (sv == &PL_sv_undef) { +#ifdef PerlIO + PerlIO *fp = PerlIO_tmpfile(); +#else + PerlIO *fp = tmpfile(); +#endif + if (fp != Nullfp && do_open(gv, "+>&", 3, FALSE, 0, 0, fp)) + PUSHi( (I32)PL_forkprocess ); + else + RETPUSHUNDEF; + RETURN; + } tmps = SvPV(sv, len); if (do_open(gv, tmps, len, FALSE, O_RDONLY, 0, Nullfp)) PUSHi( (I32)PL_forkprocess ); -- cgit v1.2.1