I've got a CGI script which I need to call another perl script (myscript.pl) in the background (non-blocking) and then continue on displaying the HTML headers.
I use a $step variable, where $step=0 indicates to launch the Perl script and then $step automatically increments with each automatic page refresh. The page refresh is necessary to display real-time output.
My issue is that the call to myscript.pl seems to block and doesn't display any HTML when step=0 is passed as a CGI parameter - although the script is still launched. How can I correct this behavior to make the call non-blocking and display the HTML page? Thanks.
my $args = new CGI;
blah blah blah
if($args->param('step') == 0)
$step = 1;
my $proc1 = Proc::Background->new("perl","./myscript.pl","arg1","arg
elsif($args->param('step') > 0)
$step = $args->param('step');
print <input type=\"hidden\" name=\"step\" value=\"$step\">";