> ahh yes, thank you.  but i ran into a little problem.  consider the code:
>
> open PIPE, "| /usr/bin/mplayer args" or die "failed to open pipe, $!"
> while ( <PIPE> ) {
>       if ($condition) {
>               close(PIPE);
>       }
>       else    {
>               # process line
>       }
> }
>
> it seems that when i close the pipe before EOF, whatever i type in the
> terminal that started the perl script is no longer echoed onto the screen.
> i.e. the script ends and whatever i type into the console isn't echoed on the
> screen (but its there).  what gives?  =/
>
Well, I typed up a similar program and didn't see the same symptoms
although I have seen this type of thing before.  But my guess is that
even so the program is not doing what you think it is.

A.   open FILE, "| $command"
opens a file pointer for writing to $command's stdin.
I.e.
print FILE "stuff\n";
while:
B.   open FILE, " $command | ";
opens a file pointer for reading $command's stdout.

You probably want to try the second version.
There are plenty of possible reasons why your program is
behaving this way, such as giving an empty stdin to
$command, trying to read from a write pipe, or the fact that
$command is printing to screen instead of <FILE> and possibly
printing invisible characters that foul up your terminal.

The part about $command printing to screen is the important
part.  If you use type A, there will be no text to process.

--
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Mark Price
SysAdmin and Operations Manager, The JIMINI Project,
Applied Global Systems Lab, University of North Florida
Phone (Office): 904-620-3880 (Mobile): 904-626-8172
mailto: [EMAIL PROTECTED]
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to