fork in Win32 Perl is just simulated using threads and separate interpreter instances. So, no, after fork you still only have one process so, in particular, all file handles are shared.
Instead of using fork, you need to create a new process. Something like:
#!/usr/bin/perl -w
my $CMD = 'cat';
use IO::Handle;
use IPC::Open3 qw( open3 );
use strict;
my $pid;
if( $^W =~ /mswin32/i ) {
unless( @ARGV && $ARGV[0] =~ /^-child$/i ) {
$pid= system( 1, qq("$^X" "$0" -child) )
or die "system() failed: $!\n";
} else {
shift @ARGV;
$pid= 0;
}
} else {
$pid = fork();
if ( !defined($pid) ) {
die( "$$: Fork failed: $!\n" );
}
}
# parent
if ( $pid ) {
#...
(not fully tested)
-
tye
(but my friends call me "Tye")