the idea is to process the STDOUT ad the STDERR. open don't do it
Best Regards Marcos Rebelo On Sun, Aug 29, 2010 at 6:08 AM, John W. Krahn <jwkr...@shaw.ca> wrote: > C.DeRykus wrote: >> >> Since you mention simplifying the code, do you actually >> need IPC::Open3 ? In your sample code, you're only >> reading process output. >> >> If you don't need IPC::Open3 complexity, you could just >> use magic open to read output : >> >> sub shell_run >> { >> print "YYYY"; >> my $pid = open( my $fh, qq{ @_ | } ) or die "open: $!"; > > Probably better as: > > my $pid = open my $fh, '-|', @_ or die "open: $!"; > > And you don't use $pid anywhere so why create it? > >> print for<$fh>; > > Probably better as: > > print while <$fh>; > >> close $fh or die "close: ", $? || $!; > > Probably better as: > > close $fh or die $! ? "Error closing pipe: $!" > : "Exit status $? from $_[0]"; > >> print "ZZZZ"; >> } >> trap { shell_run( 'perl', '-E', '"print \'TEXT IN\'"' ) }; >> is( $trap->stdout, "YYYYTEXT INZZZZ"); >> done_testing(); > > > > John > -- > Any intelligent fool can make things bigger and > more complex... It takes a touch of genius - > and a lot of courage to move in the opposite > direction. -- Albert Einstein > > -- > To unsubscribe, e-mail: beginners-unsubscr...@perl.org > For additional commands, e-mail: beginners-h...@perl.org > http://learn.perl.org/ > > > -- Marcos Rebelo http://oleber.freehostia.com Milan Perl Mongers leader http://milan.pm.org Webmaster of http://sites.google.com/site/oleberperlrecipes/ -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/