http://www.perlmonks.org?node_id=970667


in reply to Re^2: What is the preferred cross-platform IPC module?
in thread What is the preferred cross-platform IPC module?

Take a look at winopen2() in Win32::SocketPair.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?

Replies are listed 'Best First'.
Re^4: What is the preferred cross-platform IPC module?
by Theory (Beadle) on May 15, 2012 at 16:12 UTC
    I don't have Windows, and besides, that would completely defeat the purpose: I don't want to have to think about platform issues or any error-handling beyond trapping exceptions. I want a module that does all that for me. I like IPC::System::Simple, for example, which appears to do a nice job of it if all I want to do is system or backticks. IPC::Run may or may not succeed in doing it for interactive IPC, I'm still trying to figure that out.

      Sorry, for trying to help.

      My experiences of using IPC::Run on windows are dire. It is an over-engineered behemoth of a module that attempts to use *nix techniques to provide *nix capabilities on Windows, and fails dismally.

      The point about winopen2 is that it provides you with a pair of selectable handles connected to the child process' STDIN & STDOUT.

      As such, it is 'compatibile' with *nix-style code written using IPC::Open2 and select.

      Ie. you'd only need do something like:

      my( $in, $out ); if( $^O eq 'MSWin32' ) { ($in, $out ) = winopen2( $theCommand ); } else { open2( $in, $out, $theCommand ); } ... select .....

      But, its not in a module so ...


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      The start of some sanity?

        I appreciate the help. That doesn't look bad, but then what does one do about error handling? Can errors from the child caught? At exec time? After that? That's what I imagine a module would take care of.

        I agree about IPC::Run. I am just surprised that there isn't a decent solution to this problem. Must come up all the bloody time…

      It seems to me that your response of

      besides, that would completely defeat the purpose: I don't want to have to think about platform issues

      conflicts with

      I started implementing the module I have been imagining,

      that was stated in the node that was being responded to.

      At least, I expect that creating a module that saves users from having to deal with "platform issues" that they would otherwise have to deal with pretty much requires that the author "think about [those] platform issues".

      - tye