... where the Data::Denter patterns of the variables are approximately:$water = { map { my $process = $_; my @inputs = @ {$processes{$process}[1]}; $_, { prerequisites => [ @inputs ], oo_output => sub { my ($data) = shift; my ($pid, @fh, $active); @fh = map { $data->get($_) } @inputs; push @fh, \*STDIN if ((defined $start) and $start eq $ +process); $active = scalar @fh; local (*IN, *OUT, $/, $\); $/ = 1; $\ = ''; open2 \*OUT, \*IN, $processes{$process}[0]; select(IN); for (;;) { my $piece = join '', map { (eof $_) ? "\0" : <$_> } @fh; (grep { not eof $_ } @fh) ? (print $piece) : (last); } close (IN); return \*OUT; } } } keys %processes }; tie %river, 'Data::Flow', $water; { my $output = $river{$final}; local $/ = undef; local $_; $_ = <$output>; print; } exit 0;
# \%processes
%
<name> => @
<command>
@
<inputs' names, one per element>
# \@pipes
@
@
<from>
<to>
# $start
<which process connects to STDIN>
# $final
<which process connects to STDOUT>
... and the data file:
process 1stcat perl -spew ..\gismu.text process 2ndcat perl -spew ..\cmavo.text process 3rdcat perl -spew pipe 1stcat 3rdcat pipe 2ndcat 3rdcat final 3rdcat... and a prompt transcript under Win32 (#s are special actions):
C:\premchai21\perl>perl multipipe.pl -f pipes #hang # #kill.# -p destination: Broken pipe -p destination: Broken pipe #hang # #kill!# C:\premchai21\perl>I tried it in the Perl debugger too, but it was rather unhelpful. What is going wrong? Running ActiveState Perl 5.6.0, build 623, on Win98.
In reply to Deadlock occurring, reason unknown by premchai21
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |