On reflection, it is actually simpler to put this into one script. Also, I forgot to include CGI::Carp. See attached script for improved code.
-- Simon Oliver #!perl -T # queue.cgi -- [EMAIL PROTECTED], 2002-04-18 use warnings; use strict; use CGI; use CGI::Carp qw(fatalsToBrowser); my $dir = 'C:/temp'; my $q = new CGI; my $id = $q->param('id'); my $data = $q->param('data'); if (length($data) > 0) { # generate the unique id and input file $id = time(); my $file = "$dir/$id.in"; open FH, ">$file" or die "Error opening value file '$file' for write: $!\n"; print FH $data; close FH; } if (length($id) > 0) { my $file = "$dir/$id.out"; if (-e $file) { # display the results page open FH, "<$file" or die "Error opening result file '$file' for read: $!\n"; my @results = <FH>; close FH; print $q->header, $q->start_html(-title=>'Results'); print $q->p("Here are the results with id=$id."); print $q->menu($q->li(\@results)); print $q->end_html; } else { # display the results pending page print $q->header; print $q->start_html( -title => 'Results Pending', -head => $q->meta({ -http_equiv => 'Refresh', -content => "4; URL=?id=$id;"}) ); print $q->p([ "Your query has been submitted and assigned with id=$id. ", "Your browser should periodically update this page and display the results when they become available. ", "If your browser does not automatically refresh this page click <A HREF=\"?id=$id\">here</A> to display the results. " ]); print $q->end_html; } } else { # display the form print $q->header, $q->start_html(-title => 'Form'); print $q->start_form, $q->textfield(-name => 'data'), $q->submit(-value => 'go'), $q->end_form; print $q->end_html; } _______________________________________________ Perl-Win32-Web mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs