Pipe Between Programs



CREATING A PIPE BETWEEN TWO PERL PROGRAMS

Windows and ActiveState Perl are being used

Can anyone supply the code for creating two direction pipes between two Perl programs that are running at the same time?

A separate goal is to learn how to establish two direction pipes between a Perl program and some other language program. It is assumed that the same type of procedure would be used.

The following code is presently being used to create a one direction pipe between a Perl program and the Gnuplot graphics program. I have not yet been able to learn how to easily modify it so that a connection can be established between two Perl programs.


open gnuplot, 'pgnuplot.exe';
use FileHandle;
gnuplot->autoflush(1);

print gnuplot 'some command', "\n";

close gnuplot;

Using that code, the Gnuplot graphics programs pgnuplot.exe and wgnuplot.exe both need to be in the same directory as the Perl program.


After the pipe is created, how does one Perl program input information from the other? I am guessing that it is some variation of the readline command such as:

$temp = readline program2;


One of the goals here is to develop procedures that will enable researchers around the world to work on the same scientific projects while using whatever computer languages they prefer.

.



Relevant Pages

  • Re: Pipe Between Programs
    ... Can anyone supply the code for creating two direction pipes between two Perl programs that are running at the same time? ... pipe between a Perl program and the Gnuplot graphics program. ... AFAIK it's then just a question of buffering, of using binary I/O functions for binary data and of using appropriate character encodings for character data. ...
    (comp.lang.perl.misc)
  • Re: Key press detection June 4, 2009
    ... A Perl program starts a Gnuplot graphics program that generates a chart. ... When it detects something like a Left Arrow key press it tells Gnuplot to draw something different on the chart. ... A problem we encountered was how to have the Perl program monitor key presses. ...
    (microsoft.public.windowsxp.general)