[Catalyst] Setting file handle as the response body generates
neil at mylunn.id.au
Thu Nov 21 15:19:06 GMT 2013
On 22/11/2013 12:33 AM, Bill Moseley wrote:
> On Wed, Nov 20, 2013 at 11:32 PM, neil.lunn <neil at mylunn.id.au =
> <mailto:neil at mylunn.id.au>> 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 =3D read_file "product.json.gz";
> my $io =3D IO::Scalar->new( \$z );
> $io->seek( -4, 2 );
> $io->read( my $buf, 4);
> my $uncompressed_size =3D unpack( 'V', $buf );
> This indeed does work in my tests. Thanks for all the help, Neil. =
> I really appreciate the time you spent on this.
No prob. Part of my thing on list reponses is that there is a seed for =
others to learn from what was discussed.
I do wonder if there is a sane way to test for an in memory file handle =
and give a more appropriate warning, but that is for further discussion.
> -- =
> Bill Moseley
> moseley at hank.org <mailto:moseley at hank.org>
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://firstname.lastname@example.org=
> Dev site: http://dev.catalyst.perl.org/
This email is free from viruses and malware because avast! Antivirus protec=
tion is active.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Catalyst