Re: Pipe input over several scripts
- From: spoertsch <spoertsch@xxxxxxxxx>
- Date: Mon, 21 Jan 2008 00:45:41 -0800 (PST)
Hi,
The problem is that script c is not getting the input.
Script A:
#!/usr/bin/perl
use strict;
use warnings;
use IPC::Open2;
my @input = ('test1', 'test2', 'test3', 'test4');
my $out = "";
my $timeout = 7200;
my $RDR;
my $WTR;
my $cmd = 'perl script_b.pl';
my $pid = open2($RDR,$WTR, $cmd) || die("ERROR: Could not execute: " .
$cmd);
foreach (@input){
print $WTR $_."\n";
}
close($WTR);
if (defined $RDR) {
while (<$RDR>) {
$out .= $_;
}
}
print "\n\n";
print $out;
wait; # wait till prozess with $pid dies
print "Script A finished\n";
Script B:
#!/usr/bin/perl
use strict;
use warnings;
my $input = '';
print "Input 1: ";
chomp($input = <STDIN>);
print $input."\n";
print "Input 2: ";
chomp($input = <STDIN>);
print $input."\n";
system('perl script_c.pl');
print "Script B finished\n";
Script C:
#!/usr/bin/perl
use strict;
use warnings;
my $input = '';
print "Input 3: ";
chomp($input = <STDIN>);
print $input."\n";
print "Input 4: ";
chomp($input = <STDIN>);
print $input."\n";
print "Script C finished\n";
.
- Follow-Ups:
- Re: Pipe input over several scripts
- From: J. Gleixner
- Re: Pipe input over several scripts
- From: xhoster
- Re: Pipe input over several scripts
- References:
- Pipe input over several scripts
- From: spoertsch
- Re: Pipe input over several scripts
- From: xhoster
- Pipe input over several scripts
- Prev by Date: Re: sprintf rouding error
- Next by Date: Re: call back to my own script
- Previous by thread: Re: Pipe input over several scripts
- Next by thread: Re: Pipe input over several scripts
- Index(es):
Relevant Pages
|