On Wednesday, Jan 15, 2003, at 06:43 US/Pacific, [EMAIL PROTECTED] wrote:
[..]
#!/usr/local/bin/perl

use IPC::Open3;
my ($commande);
$commande = 'prog <myfile.txt';
$pid = open3(*SON_IN, *SON_OUT, *SON_ERR, $commande);
close(SON_IN);
@lignes_out = <SON_OUT>;
@lignes_err = <SON_ERR>;
print "STDOUT:\n", @lignes_out, "\n";
print "STDERR:\n", @lignes_err, "\n";

p0: don't close SON_IN
	anything that you would have written into myfile.txt
	write out to SON_IN

p1: if you can rig 'prog' to take command line arguments
	then you could think about the communication in
	the simpler manner

	my $cmd = 'prog';
	my $args = '--someFlag --otherFlag';

	open(CMD, "$cmd $args 2>&1 |")
	while (<CMD>)
	{

	}

ciao
drieux

---


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to