perl - get print to print *now* in cgi script (hard to explain).
Hi Guys and Gals,
Been a Slack user for over 12 years, and this has me beat.
I have a web form that some fields drive a binary to produce results, and other fields just grep a file for results.
Now, one field when used can take a few seconds to process, so if I put a:
print "This can take a seconds...";
before the backticks line, it doesn't print UNTIL the backticks command has finished?
Yet, if the previous functions in my code are run and print, it does print first and then waits for the backticks command.
So, something like this pseudo code works:
if (match) { # true
grep file;
print $results;
}
if (match) {
print "Please wait, can take a few seconds";
$var=`command'
print $results;
}
Which then runs the output from the first match, and then prints the 'Please wait...' line as the backticks command processes.
But IF the first match is false, the 'Please wait...' line doesn't get printed until the backticks command is finished, so it all gets printed at the same time, and the user sits looking at a 'loading...' thing in their browser.
Hope you understand what I mean, and thanks for any help why this happens/what is going on.
Nick
Last edited by Linicks; 12-13-2015 at 10:57 AM.
|