<div dir="ltr">Hello all,<div><br></div><div>I'm attempting to merge an old CGI.pm-based code base into a Dancer2-powered app, and I have some questions. I had been running the old code using Plack::App::CGIBin to mount the .cgi files, but there is now enough code shared between the two that I am ready to merge the two. The shared code currently runs some preflight checks, and then parses the query params to figure out the correct modules to load and subroutine to dispatch.</div><div><br></div><div>1) The old code is written in a "print as you go" form. My initial idea was to capture the STDOUT, but unfortunately the code includes some hacks to keep the browser connection open when running long processes (rather than forking a child process and periodically checking on its process, using an event loop, etc.). There's lots of code like this:</div><div><br></div><div>print "<p>Launching lengthy process...</p>";</div><div>my $data = do_something_that_takes_ages_here();</div><div>print "<p>Finished part one of lengthy process. Starting phase two!</p>";</div><div><br></div><div>I'd like to use Dancer2's streaming/async capabilities here but am not sure how to send what is printed to STDOUT to the 'content' keyword. Can anyone help?</div><div><br></div><div>2) I'm converting the PSGI env into a CGI object using CGI::PSGI; apart from HTTP headers, is there anything else I need to take care of?</div><div><br></div><div>Thank you for any help and hints!</div><div><br></div><div>Amelia.</div><div><br></div></div>