diff options
author | Graham Barr <gbarr@pobox.com> | 1998-02-27 04:15:04 +0000 |
---|---|---|
committer | Malcolm Beattie <mbeattie@sable.ox.ac.uk> | 1998-02-27 15:34:06 +0000 |
commit | 1d603a678689f1e74cf73914a432b2a8d38be470 (patch) | |
tree | 33c7de394ba486768d2f28151acdfc70f0df179f /pp_sys.c | |
parent | bf99883da2fbc1b4d546abddb96990a37466b881 (diff) | |
download | perl-1d603a678689f1e74cf73914a432b2a8d38be470.tar.gz |
_60 & _04 - Add WRITE & CLOSE to TIEHANDLE
p4raw-id: //depot/perl@595
Diffstat (limited to 'pp_sys.c')
-rw-r--r-- | pp_sys.c | 29 |
1 files changed, 29 insertions, 0 deletions
@@ -356,11 +356,23 @@ PP(pp_close) { djSP; GV *gv; + MAGIC *mg; if (MAXARG == 0) gv = defoutgv; else gv = (GV*)POPs; + + if (SvRMAGICAL(gv) && (mg = mg_find((SV*)gv, 'q'))) { + PUSHMARK(SP); + XPUSHs(mg->mg_obj); + PUTBACK; + ENTER; + perl_call_method("CLOSE", G_SCALAR); + LEAVE; + SPAGAIN; + RETURN; + } EXTEND(SP, 1); PUSHs(boolSV(do_close(gv, TRUE))); RETURN; @@ -1319,8 +1331,25 @@ PP(pp_send) char *buffer; int length; STRLEN blen; + MAGIC *mg; gv = (GV*)*++MARK; + if (op->op_type == OP_SYSWRITE && + SvRMAGICAL(gv) && (mg = mg_find((SV*)gv, 'q'))) + { + SV *sv; + + PUSHMARK(MARK-1); + *MARK = mg->mg_obj; + ENTER; + perl_call_method("WRITE", G_SCALAR); + LEAVE; + SPAGAIN; + sv = POPs; + SP = ORIGMARK; + PUSHs(sv); + RETURN; + } if (!gv) goto say_undef; bufsv = *++MARK; |