<div dir="ltr"><div>I'm retrofitting Dancer onto an existing perl application of mine. However, some of the code, for large report generations, will directly print to the web buffer. This is resulting in nothing come back in my response. E.g, with this route handler: <br>
<br>get '/buffertest' => sub {</div><div><span class="" style="white-space:pre"> </span>my $r = request->input_handle;</div><div><span class="" style="white-space:pre"> </span>$r->print("hello world");</div>
<div><span class="" style="white-space:pre"> </span># ref $r == Apache2::RequestRec</div><div><span class="" style="white-space:pre"> </span>return;</div><div>};</div><div><br><br>And then I make a request to it...<br><br>
</div><div>==== Begin Request Dump ====</div><div>GET <a href="http://localhost/buffertest">http://localhost/buffertest</a></div><div>Content-Type: application/json<br><br></div><div>=== End Request Dump ====</div><div><br>
... , the response won't come back:<br><br></div><div>==== Begin Response Dump ====</div><div>HTTP/1.1 200 OK</div><div>Connection: close</div><div>Date: Wed, 30 Apr 2014 16:37:19 GMT</div><div>Server: Apache</div><div>
Vary: Accept-Encoding,User-Agent</div><div>Content-Length: 0</div><div>Content-Type: text/html; charset=utf-8</div><div>Client-Date: Wed, 30 Apr 2014 16:37:20 GMT</div><div>Client-Peer: <a href="http://10.5.15.5:80">10.5.15.5:80</a></div>
<div>Client-Response-Num: 1</div><div>P3P: CP="CAO PSA OUR"<br><br></div><div>=== End Response Dump ====<br><br>IF however, I do something like enable autoflushing ($|=1) then I will get "hello world" back, but that feels like a very brutal hack. Is there an equivalent way to flush response in Dancer?</div>
</div>