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?  =/

thanks for the help,
christopher

On Saturday 04 January 2003 06:03 pm, Ken Irving wrote:
> On Sat, Jan 04, 2003 at 05:45:00PM -0600, christopher j bottaro wrote:
> > hello,
> > i'm writing a little dvd to divx perl script using mencoder and a 3 pass
> > method.  i want to allow auto cropdetection and cropping.  to find the
> > crop parameters, you gotta run mplayer and watch the output for the crop
> > parameters.  well, i suppose in perl i can capture mplayer's output with
> > the backtick operators and search for the crop parameters, but the
> > problem with that is its going to take forever for the movie to finish
> > (or even one chapter to finish).  i want to be able to parse the output
> > of mplayer as its running and as soon as i parse the crop parameters, i
> > want to kill the process.  how do i do that?  i mean how can i do it
> > easily?  without starting a seperate thread or something...=P
>
> Instead of backtics, open a pipe to the process and read from it, e.g.,
> something like:
>
>     open PIPE, "| /usr/bin/mplayer args" or die "failed to open pipe, $!";
>     while ( <PIPE> ) {
>         do stuff, bail & close pipe when done
>         }
>
> Untested, but I *think* that may do the job.


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

Reply via email to