in reply to Non-blocking Reads from Pipe Filehandle

There was some discussion of Win32, pipes, and select on p5p a while ago (in the context of borging CPANPLUS and its prerequisites) that may prove discouraging to you. One sub-thread was IPC::Run on win32 failures. I'm not sure how you go about using WaitForMultipleObjects from perl, if that's a possible solution.
  • Comment on Re: Non-blocking Reads from Pipe Filehandle

Replies are listed 'Best First'.
Re^2: Non-blocking Reads from Pipe Filehandle (WaitForMult...)
by tye (Sage) on Jun 13, 2007 at 22:28 UTC

    Probably use one or more sub from Win32::IPC:

    use Win32::IPC qw( wait_any wait_all WaitForMultipleObjects INFINITE );

    - tye        

      Yes, I saw that, but didn't see an interface that allowed you to specify a handle. I found the doc a little confusing, both for Win32::IPC and its subclasses.

        I assumed worst case was use of Win32API::File's GetOsFHandle().

        But diving into the XS code I see that the module is about as poorly designed as any. As is all too common for XS modules and Win32:: modules especially, it has way too much XS code that can only handle the very narrowest of types of input. *sigh* If you pass it an object that "isa" subclass of Win32::Process, then it will call the object's get_process_handle() method. If you pass it an object that "isa" subclass of Win32::IPC, then it expects that to be a ref to a scalar containing the integer handle value.

        So you could probably get away with something like:

        my $handle= bless \GetOsFHandle(*PIPE), "Win32::IPC";

        which is pretty ugly and likely to break at some future date.

        - tye