in reply to Re: IPC::Run and subprocess interaction
in thread IPC::Run and subprocess interaction
Just for the sake of curiosity. $TOK_OUT doesn't seem to be an ordinary variable. If you run the following program:
You will get:#!/usr/bin/perl -w use IPC::Run qw(start pump finish timeout); my $tok_program = "/bin/./cat"; my ($TOK_IN, $TOK_OUT, $TOK_ERR); my $TOK = start [$tok_program], '<', \$TOK_IN, '1>pty>',\$TOK_OUT, '2>', \$TOK_ERR , debug => 0 or die "Error: $?;\n"; while (my $line = <STDIN> ) { # Send input. $TOK_IN = $line; pump $TOK while length $TOK_IN; # Wait for output. pump $TOK while $TOK_OUT !~ /\n\z/; my $msg = $TOK_OUT; chomp($msg); print "out:$TOK_OUT;;MESSAGE=$msg;;END\n"; $TOK_OUT = ''; } finish($TOK) or die "returned: $?";
Instead of:out:1. line ;;ENDSAGE=1. line out:2. line ;;ENDSAGE=2. line
Do you know why? Once more - thank you!out:1. line ;;MESSAGE=1. line;;END out:2. line ;;MESAGE=2. line;;END
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: IPC::Run and subprocess interaction
by ikegami (Patriarch) on Jul 15, 2011 at 18:16 UTC | |
by xhudik (Initiate) on Jul 18, 2011 at 15:24 UTC | |
by ikegami (Patriarch) on Jul 18, 2011 at 17:27 UTC |