# testparent.pl use Win32API::File; use IO::Handle; use Symbol qw(gensym); use IO::Socket; use Win32::Process; sub win32_spawn_child { my $program = shift; my $cmd = shift; my $inherit = shift; if( ! Win32::Process::Create($last_process, $program, $cmd, $inherit, &CREATE_NO_WINDOW, ".") ) { print "$^E\n"; return 0; } my $pid = $last_process->GetProcessID() || do { print "$^E\n"; }; return $pid; } my ($child_socket, $parent_socket); socketpair($child_socket, $parent_socket, Socket::AF_UNIX, Socket::SOCK_STREAM, Socket::PF_UNSPEC) or die "Unable to create socketpair for transfer agent: $!"; $child_socket->autoflush(1); $parent_socket->autoflush(1); my $perl = "c:\\perl-5.14.2\\bin\\perl.exe"; my $handle = Win32API::File::GetOsFHandle($parent_socket); my $handle1 = Win32API::File::GetOsFHandle($child_socket); print syswrite($child_socket, "abcdef\n"), "\n"; win32_spawn_child($perl, "$perl c:\\temp\\JOBCON-2902\\testchild.pl $handle $handle1", 1); close $parent_socket; $child_socket->blocking(1); my $buf; my $bytes_read = sysread($child_socket, $buf, 1024); print $buf, "\n"; exit 0;