Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
second program net2.plmy $count =0; for (1.10){ warn "Writing line $_\n"; #!/usr/bin/perl use strict; $SIG{PIPE} = 'IGNORE'; open (PIPE,"| net2.pl") or die "Cannot open pipe:$!"; select PIPE ; $ |=1; select STDOUT; my $count =0; for (1.10){ warn "Writing line $_\n"; if (print PIPE "This is line number $_\n") { $count ++; } else { warn " An error occured during writing :$!"; last; } sleep 1; } close PIPE or die " Cannot close pipe : $!"; print "Wrote $count lines of text \n"; ~
OUTPUT ./net.pl Writing line 1.1 Cannot close pipe : at ./net.pl line 19. 6 + Stopped (SIGTTIN) ./net2.pl &#!/usr/bin/perl use strict; for (1.3) { last unless defined (my $line = <>); warn " Read_three,got $line\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: PIPE problem
by borisz (Canon) on Jan 15, 2004 at 18:47 UTC | |
|
Re: PIPE problem
by ysth (Canon) on Jan 15, 2004 at 18:45 UTC | |
|
Re: PIPE problem
by pg (Canon) on Jan 15, 2004 at 18:39 UTC |