in reply to Inter-Process Communication

I'm not sure about the specifics of your Win32 installation. Under cygwin, fork and pipe are implemented, so the following code works:
pipe B,A; my $child = fork; die "fork: $!" unless defined $child; if ($child != 0) { use IO::Handle; close B; print A "hello\n"; A->flush; sleep 1; print A "world\n"; exit; } close A; while (<B>) { print; }
You can do use select to poll the filehandle. Of course, you could simply use your socket instead of opening the pipe. --Dave.

Replies are listed 'Best First'.
Re: Re: Inter-Process Communication
by Nitrox (Chaplain) on Jul 21, 2002 at 02:48 UTC
    I'm running ActiveState's Perl 5.6.1 build633 and your example runs without errors, but with odd results.

    It produces no output and hangs indefinetly, but when I ctrl-C the console it then outputs 'hello'. Seems to be a deadlock situation?

    Also, instead of fork'ing an entire copy, is there a way to spawn a thread that is capable of accessing variables in the parent thread?