Re: [Catalyst] Setting file handle as the response body generates warnings.

2013-11-30 Thread John Napiorkowski
On Wednesday, November 27, 2013 8:03 AM, neil.lunn wrote: On 27/11/2013 4:28 AM, John Napiorkowski wrote: Awesome, send me a pull request :) > > >https://github.com/perl-catalyst/catalyst-runtime > John. The pull is there along with another doc patch I noticed when playing around with d

Re: [Catalyst] Setting file handle as the response body generates warnings.

2013-11-27 Thread neil.lunn
On 27/11/2013 4:28 AM, John Napiorkowski wrote: Awesome, send me a pull request :) https://github.com/perl-catalyst/catalyst-runtime John. The pull is there along with another doc patch I noticed when playing around with downstream PSGI invocations. I think the change is sane as it worked for

Re: [Catalyst] Setting file handle as the response body generates warnings.

2013-11-26 Thread John Napiorkowski
   }   It resolves the out of memory issue if you try to print direct to $c->response->body without putting the content in an IO::File object.     From:John Napiorkowski [mailto:jjn1...@yahoo.com] Sent: 26 November 2013 01:54 To: The elegant MVC web framework Subject: Re: [Catalyst] Setting f

Re: [Catalyst] Setting file handle as the response body generates warnings.

2013-11-26 Thread John Napiorkowski
Awesome, send me a pull request :) https://github.com/perl-catalyst/catalyst-runtime On Tuesday, November 26, 2013 1:24 AM, neil.lunn wrote: On 26/11/2013 12:54 PM, John Napiorkowski wrote: We should probably document what it means by $c->response->body can accept a file handle.  Like pla

RE: [Catalyst] Setting file handle as the response body generates warnings.

2013-11-26 Thread Craig Chant
$iof); # close file undef $iof; } It resolves the out of memory issue if you try to print direct to $c->response->body without putting the content in an IO::File object. From: John Napiorkowski [mailto:jjn1...@yahoo.com] Sent: 26 November 2013 01:54 To: The elegant

Re: [Catalyst] Setting file handle as the response body generates warnings.

2013-11-25 Thread neil.lunn
On 26/11/2013 12:54 PM, John Napiorkowski wrote: We should probably document what it means by $c->response->body can accept a file handle. Like plack specifies the interface it must deal with. Anyone up to that? Something along these lines maybe? Catalyst can accept a file handle type of ob

Re: [Catalyst] Setting file handle as the response body generates warnings.

2013-11-25 Thread John Napiorkowski
We should probably document what it means by $c->response->body can accept a file handle.  Like plack specifies the interface it must deal with.  Anyone up to that? This FH in body thing is something I've been thinking about a lot lately, in regards to when Catalyst is running under an event lo

Re: [Catalyst] Setting file handle as the response body generates warnings.

2013-11-21 Thread neil.lunn
On 22/11/2013 12:33 AM, Bill Moseley wrote: On Wed, Nov 20, 2013 at 11:32 PM, neil.lunn > wrote: This approach may work for you is the compressed data is actually in a scalar and not too large. And not too small. YMMV. my $z = read_file "product.json.g

Re: [Catalyst] Setting file handle as the response body generates warnings.

2013-11-21 Thread Bill Moseley
On Wed, Nov 20, 2013 at 11:32 PM, neil.lunn wrote: > > This approach may work for you is the compressed data is actually in a > scalar and not too large. And not too small. YMMV. > > my $z = read_file "product.json.gz"; > > my $io = IO::Scalar->new( \$z ); > $io->seek( -4, 2 ); > $io->read( my $b

Re: [Catalyst] Setting file handle as the response body generates warnings.

2013-11-20 Thread neil.lunn
On 21/11/2013 11:48 AM, Bill Moseley wrote: $ perl -MIO::Uncompress::Gunzip -le 'use Data::Dumper; print Dumper +IO::Uncompress::Gunzip->new( "Catalyst-Runtime-5.90051.tar.gz" )->getHeaderInfo' Actually with more reading on this getting the uncompressed size reliably can be a real pain, and

Re: [Catalyst] Setting file handle as the response body generates warnings.

2013-11-20 Thread neil.lunn
On 21/11/2013 1:04 PM, neil.lunn wrote: On 21/11/2013 11:48 AM, Bill Moseley wrote: $ perl -MIO::Uncompress::Gunzip -le 'use Data::Dumper; print Dumper +IO::Uncompress::Gunzip->new( "Catalyst-Runtime-5.90051.tar.gz" )->getHeaderInfo' Oh, and a test case outside of catalyst, noting the -s ope

Re: [Catalyst] Setting file handle as the response body generates warnings.

2013-11-20 Thread neil.lunn
On 21/11/2013 11:48 AM, Bill Moseley wrote: Seems noncompliance may be rampant. Anyway, sounds like Catalyst isn't quite supporting this kind of file handle as expected. John, is there anything you would want me to try? Hi Bill. Back to my original response, trying to get the size of thi

Re: [Catalyst] Setting file handle as the response body generates warnings.

2013-11-20 Thread Bill Moseley
On Wed, Nov 20, 2013 at 3:45 PM, neil.lunn wrote: > 2.3.1.2. Compliance > > > A compliant compressor must produce files with correct ID1, > ID2, CM, CRC32, and ISIZE, but may set all the other fields in > the fixed-length part of the header to default values (255 for

Re: [Catalyst] Setting file handle as the response body generates warnings.

2013-11-20 Thread neil.lunn
On 21/11/2013 4:08 AM, Bill Moseley wrote: On Wed, Nov 20, 2013 at 7:37 AM, Bill Moseley > wrote: On Wed, Nov 20, 2013 at 4:08 AM, neil.lunn mailto:n...@mylunn.id.au>> wrote: my $length = $body->getHeaderInfo Well, that's helpful. Thanks. Complet

Re: [Catalyst] Setting file handle as the response body generates warnings.

2013-11-20 Thread Bill Moseley
On Wed, Nov 20, 2013 at 7:37 AM, Bill Moseley wrote: > > On Wed, Nov 20, 2013 at 4:08 AM, neil.lunn wrote: > >> my $length = $body->getHeaderInfo > > > Well, that's helpful. Thanks. Completely missed that in the docs. > Well, except for the actual files I have no ISIZE: $VAR1 = {

Re: [Catalyst] Setting file handle as the response body generates warnings.

2013-11-20 Thread Bill Moseley
On Wed, Nov 20, 2013 at 4:08 AM, neil.lunn wrote: > my $length = $body->getHeaderInfo Well, that's helpful. Thanks. Completely missed that in the docs. -- Bill Moseley mose...@hank.org ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.

Re: [Catalyst] Setting file handle as the response body generates warnings.

2013-11-20 Thread neil.lunn
On 20/11/2013 3:01 PM, Bill Moseley wrote: I just updated: $ perl -MCatalyst -le 'print Catalyst->VERSION' 5.90051 I can debug more in the morning -- anything specific I should look at? I think the stat operators have this problem on any type of in memory filehandle. That is pretty easy to r

Re: [Catalyst] Setting file handle as the response body generates warnings.

2013-11-19 Thread Bill Moseley
On Tue, Nov 19, 2013 at 6:34 PM, John Napiorkowski wrote: > > This looks familiar, but I thought we fixed this... what version of > Catalyst are you using here? > I just updated: $ perl -MCatalyst -le 'print Catalyst->VERSION' 5.90051 I can debug more in the morning -- anything specific I sho

Re: [Catalyst] Setting file handle as the response body generates warnings.

2013-11-19 Thread John Napiorkowski
This works, but Catalyst in finalize_headers issues two warnings: -s on unopened filehandle GEN10 at /home/bill/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/Catalyst.pm line 1893. > > >[warn] Serving filehandle without a content-length Are those warning a problem with how Catalys

[Catalyst] Setting file handle as the response body generates warnings.

2013-11-19 Thread Bill Moseley
Speaking of downloads, I have a gzipped file. Well, it's a file in memory. If I see Accept-Encoding that includes "gzip" it's easy. I simply return the content and set Content-Encoding: gzip and set the content length. But, if the client does not accept gzip I uncompress it using IO::Uncompress