Tim Greer <> wrote:
>
> Also, IPC::Open2 does work on Win32 or am I mistaken?
Based on my test, I'd say it doesn't work on Win32, or at least not
well.
use strict;
use warnings;
use IPC::Open2;
$|=1;
warn open2 my $in, my $out, q{sort};
print $out qq{$_\n} foreach (1..100);
close $out or die;
print while (<$in>);
This works on Linux, but hangs on Windows. It hangs at the while (<$in>).
Since sort needs to read all input before generating any output,
deadlock should not be an issue. It also leaves sort.exe hanging around.
(I actually starting using "cat"/"type", using the >& to redirect to
another filehandle to avoid deadlocks, but I couldn't figure out how to
make Window's "type" read from its stdin. So I switched to sort. Then
once using sort, I realized I no longer needed >& so simplified it. None
of these steps worked on windows).
This is perl, v5.8.8 built for MSWin32-x86-multi-thread
(with 25 registered patches, see perl -V for more detail)
Copyright 1987-2006, Larry Wall
Binary build 817 [257965] provided by ActiveState
http://www.ActiveState.com Built Mar 20 2006 17:54:25
Xho
--
--------------------
http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.