LPM: redirecting output
Mik Firestone
fireston at lexmark.com
Mon Apr 3 07:56:16 CDT 2000
Yes, there is. My preferred way is to used a piped open:
open FH, "a.out |" or die "Couldn't open the pipe";
You can then read from this like a standard file handle. The danger,
especially with an expected run time of hours, is a blocking read. Make sure
you use select correctly and don't spin the loop too tight.
There is also a warning in the manpages to only use sysread when using select
loops.
Oh - there are ( of course ) other ways. Do a perldoc perlipc and look for
the stuff on pipes.
Mik
On Mon, 3 Apr 2000 repett0%sac.uky.edu at interlock.lexmark.com wrote:
>
> Since Im running my script, that executes a c++ program, do I always have
> to catch the output and print the variable. Is there a way to avoid
>
> $temp = `a.out`;
>
> The problem is, this program takes hours to run and I don't want to wait
> to see the output.
>
> Thanks.
>
> Ill show the fuits of my labor hopefully tommorrow, my first script.
>
> Ron
>
>
>
--
Mik Firestone fireston at lexmark.com
When I become an Evil Overlord:
My pet monster will be kept in a secure cage from which it cannot escape and
into which I could not accidentally stumble.
More information about the Lexington-pm
mailing list