I've looked at Programming Perl and the Perl Cookbook, but I'm just too dense
to figure out how to do this.
I have an external program (not in perl, and not written by me). I want to
send a string to it, have it do it's thing, then return the output to my perl
program. Then, depending on the results, I might need to run the external
program again with a different string.
I'm close with the following:
open BL, "|-", "bl -d /usr/local/share/bl" #open program with parameters
or die "cant open bl fork: $!";
local $SIG{PIPE} = sub { die "bl pipe broke"};
print BL "stuff\n\n"; #send this to the program bl
close BL or die "bad close $!";
This sends the output to the screen, STDOUT. So I think my next step is to
use a socketpair so I can gather the ouput and use it.
But I can't figure out how to set this up.
Using the example in the Perl Cookbook (p. 575), here's the line that stumps
me.
socketpair (CHILD, PARENT, AF_UNIX, SOCK_STREAM, PF_UNSPEC)
this is what I tried, along with other variations (no laughing please)
socketpair (CHILD |- "bl -d /usr/local/share/bl", PARENT, AF_UNIX,
SOCK_STREAM, PF_UNSPEC)
Any help is appreciated
Ken
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]