Erlang ports and Perl

Simon Bennett simonb@REDACTED
Wed Feb 23 17:59:55 CET 2000


Sean Hinde wrote:

> 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

You could try replacing Data in the receive clause with:

	{Port, {data, Data}}

Otherwise, I'm not sure, as I've only used it to C with the {packet, N}
option to pass the length of the data between C and Erlang.

Simon Bennett
Information Systems Consultant
___________________________________________________________________

 Simon Bennett            E-mail:     simonb@REDACTED
 Ericsson Intracom        http://www.ericsson.se/UK/intracom
 1 Bede Island Road       Voice (UK)  0116 2542400
 Leicester                Voice (int) +44 116 2542400
 England                  Voice ECN:  832 707 ext 232
 LE2 7EU                  Fax:        +44 (0)116 2046111
___________________________________________________________________



More information about the erlang-questions mailing list