Hello I would like to launch in background a perl program ( or function who create lot of PDF) from my Dancer APP. and view in web page the log of this program. I've done a small test, ajax part works well, but if my process backgroup is too long with sleep , nothing works, web browser wait... What is the best way to do that ? use backtick ``, system, exec ? create sub or launch external perl program as my $output = qx|perl /util/generation.pl $id &|; print $output; or fork module ? thanks for your advice Hugues. post '/generationpdf' => sub { ... ... background(); } #my test background process sub background { open (LOG,">:encoding(UTF-8)",$PATHPDF."generationpdf.log") || die ("Problème d'ouverture du fichier de log $!"); say LOG "\n################################################"; for (my $i=0;$i<300;$i++) { # sleep 1; say LOG $i; } } AJAX PART ajax '/getloadavg' => sub { my $cmd = "tail ". $PATHPDF. "generationpdf.log"; { timestamp => time, loadavg => `$cmd`, }; TEMPLATE PART <pre>Calcul des PDF: <span id="flog"></span> </pre> <script type="text/javascript"> setInterval(function() { $.getJSON('[% request.uri_base %]/getloadavg', function(response) { var point = [ response.timestamp, response.log ];; $("#timestamp").text(response.timestamp); $("#flog").text(response.flog); }) }, 1000); </script>