in reply to parsing the results of the subroutine in real time
Knowing what OS would help.
So would answers to such questions as
Please read On asking for help and How do I post a question effectively?.
Nonetheless, here's a WAG -- barebones, unelaborated pseudocode for near-"real time" reading -- avoiding many OS specific ways to check what the executable is up to, the possibility (probability?) that the output is formatted as something other than simple text, whether the executable locks the file it's writing in increments, etc.
#!shebang use strict; use warnings; # do ...; # (whatever sets up the call) call executable # (using system, exec, backticks or ....); # First time check for file written by executable if (exists $thefile) { # the file_in_line_13) { readit(); } else { sleep (some amount of time); goto (in some form or another) 18; } sub readit { open '<', EXEOUT, $thefile ; $latest = <EXEOUT>; close EXEOUT; print "$latest \n"; # (to user); recheck(); } sub recheck { my $timesIdential = 1; sleep (time); open '<', EXEOUT, $thefile ; $newlatest = <EXEOUT>; if ( $newlatest ne $latest ) { clearscreen (OS dependant); readit(); } else { $timesIdentical++; if ($timesIdentical = n) { # for some "n" sufficient to convince you # that the executable is done clearscreen; print "Done\n\n" . $newlatest . "\n"; exit(); } } }
Update, given the detail (parallel processing) in the reply below.
Change line 22 to call a sub wherein (given this structure) you'll throw out any prior processing (wasteful and probably NWYW (® "not what you want") and to do your processing (again).
But we still have no idea of how intensive that processing is, nor how time-critical. Each of those will probably make the replacement suggested in the previous paragraph, in the infamous words of a one-time White House spokesman, "inoperative."
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: parsing the results of the subroutine in real time
by doar4forum (Initiate) on Apr 04, 2008 at 21:00 UTC | |
by mr_mischief (Monsignor) on Apr 04, 2008 at 22:15 UTC | |
by doar4forum (Initiate) on Apr 04, 2008 at 22:43 UTC | |
by BrowserUk (Patriarch) on Apr 04, 2008 at 23:35 UTC | |
by mr_mischief (Monsignor) on Apr 04, 2008 at 23:05 UTC |