[Wellington-pm] decompressing a string

Steve Piner steve.piner at signify.co.nz
Wed Nov 14 13:17:29 PST 2012


Shouldn't that be inflate rather than deflate?

Steve

On 15/11/2012 9:53 a.m., Dan Horne wrote:
> Hi Mongers
> I'm trying to convert a Python routine to Perl. The point where I'm
> stuck is where I need to decompress a string. The Python code is
> something like (extraneous code removed)
> import zlib
> mystring = '<value from previous function>'
> print zlib.decompress(mystring)
> However, it's not clear to me how to replicate this in Perl. I've tried
> use Compress::Zlib;
> my $mystring = '<value from previous function>';
> my $x = deflateInit();
> my ($out,$status) = $x->deflate($mystring );
> $status == Z_OK or die "deflation failed\n";
> print $out;
> Unfortunately, the Perl code doesn't work - $out is gobbledygook -- and
> as far as I can tell from the doco, Compress::Zlib seems to be
> interested in decompressing filehandles not strings. Any advice on how
> to decompress a string appreciated
> Dan
>
>
> _______________________________________________
> Wellington-pm mailing list
> Wellington-pm at pm.org
> http://mail.pm.org/mailman/listinfo/wellington-pm
>

-- 
Steve Piner
Senior Developer

==========================================
+SIGNIFY LIMITED :: a smarter web company+
==========================================
ph: +64 4 803-3211  |  fax: +64 4 803-3241
Level 2, 120 Featherston St, Wellington
P.O. Box 24-068, Manners St, Wellington
==========================================

This communication, including any attachment, is confidential. If you 
are not the intended recipient, you should delete/destroy this 
communication; you may not read and must not copy, send on or retain any 
part of this communication. Please do not disclose to any third party 
anything about this communication.


More information about the Wellington-pm mailing list