open() and pipes

Uri Guttman uri at
Fri Aug 4 00:51:22 BST 2006

>>>>> "DC" == David Cantrell <david at> writes:

  DC> On Tue, Aug 01, 2006 at 12:43:19PM -0400, Uri Guttman wrote:
  >> stem can do that easily...

  DC> So instead of using a module that is at least part of the core
  DC> (IPC::Open2) I should use a thid-party module which doesn't even appear
  DC> to be documented.  Errm, no.

sure if you want to do that. but with stem's version you also get the
fully buffered async i/o with callbacks and minimal coding on your
part. there is a very well documented and commented demo of a forking
server (inetd emulation with NO coding) which basically is what you
want. another example of the lower level buffered async code i created
for a sessions talk i gave last year. it it trivial to just change those
to your needs. but you can do more work or less depending on your
tastes. there are also external docs that are fairly well written and
all the constructors have very well described argument lists with help
text. all you are missing is pod which will be forthcoming next
christmas. :)

and this could be done without message passing as well by just using the
i/o callbacks in stem::proc in a pure event loop style. that module can
do message passing or OO callbacks based on the needs of the
program. just instantiate a stem::proc object (as i said its constructor
is fully documented in the code) to run your process and you have async
fully buffered i/o to that subprocess so you can never deadlock. not
much could be simpler. i bet that part would be about 30 lines of code
and most of that would be constructor arguments and the callback
handlers. doing that with ipc::open2 would need registering event loop
callbacks, buffer management, more process control than ipc::open2
offers, etc. slightly more than 30 lines of code IMNSHO.

i just offered a possible solution in an area i know very well (async
i/o). do with it as you wish. even asking me for coding help would be
possible if you would deign to do that. :)


Uri Guttman  ------  uri at  --------
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------

More information about the mailing list