Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!newstop!texsun!vector!egsner!mic!convex!convex.COM From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.lang.perl Subject: Re: perl compared to other Unix tools Message-ID: <110275@convex.convex.com> Date: 11 Dec 90 02:43:54 GMT References: <275E7B47.2EB9@tct.uucp> <9592:Dec920:40:5190@kramden.acf.nyu.edu> Sender: news@convex.com Reply-To: tchrist@convex.COM (Tom Christiansen) Organization: CONVEX Software Development, Richardson, TX Lines: 36 In article <9592:Dec920:40:5190@kramden.acf.nyu.edu> brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes: >2. Pass descriptors back and forth between programs. This is hellishly >useful for combining programs in different languages, for passing >messages securely, and for minimizing the overhead of a modular resource >controller. Practically every system in existence has some mechanism for >descriptor passing, but Perl doesn't standardize it. I'm not sure what you want here. It's pretty easy in perl to connect processes through a file descriptor: if (open(HANDLE, "|-")) { # parent code writes to HANDLE } else { # child code just reads from STDIN per usual } or else: if (open(HANDLE, "-|")) { # parent code reads from HANDLE } else { # child code just writes to STDOUT per usual } (I know -- I didn't check that open returned undefined.) You can also play more elaborate games using explicit pipe() calls. For unrelated processes, you're going to have to use named pipes or sockets. How does C offer a more standard mechanism for passing descriptors which Perl can't use? --tom -- Tom Christiansen tchrist@convex.com convex!tchrist "With a kernel dive, all things are possible, but it sure makes it hard to look at yourself in the mirror the next morning." -me