Erlang ports and Perl

Sean Hinde Sean.Hinde@REDACTED
Wed Feb 23 17:15:26 CET 2000


Hi all,

I'm having a little difficulty with using a perl script as a port program:

#!/usr/local/bin/perl
while(1) {
$cmd = <STDIN>;
print STDERR "Received OK";
print "ok";
print STDERR "Sent";
}

My erlang port program:

Port = open_port({spawn, "perlscript"}, [stream]),
Port ! {self(), {command, "hello"}},
receive
  Data ->
	Data
  after 10000
	timedout
end

The result of this is that perl receives the hello message and prints
"Received OK" and "Sent" on stderr, but my erlang process never receives
"ok". Tracing confirms that the hello message is sent to the port but
nothing is received. Using an equivalent C program as the port program with
the same erlang code works fine.

Anyone any idea?

Sean



More information about the erlang-questions mailing list