The script below creates a text file (input file) in a directory that is polled for files every 0.5 seconds. When it sees a file it reads it, processes the commands, then deletes the input file and creates an output file with the results.
The way it is written below it creates the input file and then goes directly to the next sub that creates a web page that has the contents of the output file embedded in it. But it is creating the web page before the output file is available.
What can I do to make the print_html sub wait until the output file is available before printing it? The complete script is located at: http://www.loadfinders.com/test/routing.txt
$side_bar = 'D:\home\routing\www\cgi-bin\includes\sidebar.txt';
$rt_url = 'D:\home\routing\www\pmx';
$footer = 'D:\home\routing\www\cgi-bin\includes\footer.txt';
$session = $$.time;
$report = 'D:\home\routing\www\pmx\output_rt$session.out';
&parse_form;
open(ROUTE, ">>$rt_url/input_rt$session.in");
print ROUTE "-rcd -rs -p -ob -op\n$form{'c0'}, $form{'s0'}*$form{'c1'}, $form{'s1'}\n";
close(ROUTE);
#
# NEED SOME SORT OF DELAY OR FILE CHECK ADDED HERE
#
&print_html;
Thanks!
Jimmy Crow
http://www.homewithgod.com/
The way it is written below it creates the input file and then goes directly to the next sub that creates a web page that has the contents of the output file embedded in it. But it is creating the web page before the output file is available.
What can I do to make the print_html sub wait until the output file is available before printing it? The complete script is located at: http://www.loadfinders.com/test/routing.txt
Code:
$admin_email = 'mileage@LoadFinders.com'; $side_bar = 'D:\home\routing\www\cgi-bin\includes\sidebar.txt';
$rt_url = 'D:\home\routing\www\pmx';
$footer = 'D:\home\routing\www\cgi-bin\includes\footer.txt';
$session = $$.time;
$report = 'D:\home\routing\www\pmx\output_rt$session.out';
&parse_form;
open(ROUTE, ">>$rt_url/input_rt$session.in");
print ROUTE "-rcd -rs -p -ob -op\n$form{'c0'}, $form{'s0'}*$form{'c1'}, $form{'s1'}\n";
close(ROUTE);
#
# NEED SOME SORT OF DELAY OR FILE CHECK ADDED HERE
#
&print_html;
Thanks!
Jimmy Crow
http://www.homewithgod.com/