Re: [Catalyst] $c->write() buffering?

2013-11-08 Thread Daniel J. Luke
I took a look (which I noted below) Plack::Handler::FCGI also doesn't ever call FCGI::Flush() and doesn't expose the FCGI request variable (the thing returned from FCGI::Request()). So, without extra ugly hackery, if you're running under mod_fastcgi, you can't send 1k to the client, do some wor

Re: [Catalyst] $c->write() buffering?

2013-11-08 Thread John Napiorkowski
Daniel, Have you taken a look at what Plack's FCGI handlers does?  I'm not so familiar with the intricacies of FCGI but here's the source: https://metacpan.org/source/MIYAGAWA/Plack-1.0029/lib/Plack/Handler/FCGI.pm psgi.input is set to STDIN it appears.  Not sure if that is what you are looki

Re: [Catalyst] $c->write() buffering?

2013-11-07 Thread Daniel J. Luke
I've done some more experimentation and this doesn't end up working very well for us. For the list archive: You can accomplish what I was going for using mod_fastcgi and a standalone FCGI-based script. mod_fastcgi needs to be configured with its -flush option /and/ you need to be able to call F

Re: [Catalyst] $c->write() buffering?

2013-11-01 Thread John Napiorkowski
I was reviewing code last night for release of Catalyst Hamburg dev5 and saw that $c->res->write is just calling the writer under the hood.  So as long as your headers are ready to finalize, that should be fine as well.  Just remember this approach is going to block, so be careful with anything

Re: [Catalyst] $c->write() buffering?

2013-10-31 Thread John Napiorkowski
Recent releases of Catalyst makes it possible to stream write, although you need to be careful when using a blocking web server (long stream will of course block the available listener). Older versions of Catalyst had similar ability with the write method, I never used it, and would be happen t

Re: [Catalyst] $c->write() buffering?

2013-10-31 Thread John Napiorkowski
Also, check out  https://github.com/jjn1056/Perl-Catalyst-AsyncExample which has a few examples related.  Those are more about async IO but the approach is the same, just more simple since you don't need to run a lot of callbacks. Basically post PSGI Catalyst returns a deferred response to th

Re: [Catalyst] $c->write() buffering?

2013-10-31 Thread Daniel J. Luke
I replicated this today outside of Catalyst (just a small FCGI/FCGI::ProcManager test script). If anyone else has seen this/fixed it, I'd appreciate a pointer. I'll report back to the list if/when I get it resolved so that there's an answer in the list archives for future people to google other

Re: [Catalyst] $c->write() buffering?

2013-10-31 Thread Daniel J. Luke
We're actually running Catalyst::Runtime 5.80031 (currently), so I believe it's using Catalyst::Engine::FastCGI which just does *STDOUT->syswrite() I guess I try to do some testing with newer Catalyst (and maybe alternate deployment methods), to see if that changes anything. Looking through the

Re: [Catalyst] $c->write() buffering?

2013-10-30 Thread Hailin Hu
It is an engine relevant stuff. Find which engine you are using ( for example, Plack::Handler::FCGI ) and look around codes around write(r), you may find something. Good luck :) On Wed, Oct 30, 2013 at 9:51 AM, Daniel J. Luke wrote: > I've got some legacy CGI code that does a bunch of processing

[Catalyst] $c->write() buffering?

2013-10-29 Thread Daniel J. Luke
I've got some legacy CGI code that does a bunch of processing and uses the old hack of $| = 1; print "foo\n"; do_work(); print "foo done\n"; etc. (solution #1 from http://wiki.catalystframework.org/wiki/longcomputations) While I'll eventually convert it to a job queue, I'd like to create an out