[Wellington-pm] decompressing a string

Dan Horne dan.horne at redbone.co.nz
Wed Nov 14 15:08:44 PST 2012


Hi All

Thanks for your reponses. You're right - using a scalarref is what I
needed. My source data was following a pattern similar to Grant's -
uncompressing a base 64 decoded string. IO::Uncompress::Inflate is what
worked for me rather than the RawInflate version

Dan

On 15 November 2012 10:15, Grant McLean <grant at mclean.net.nz> wrote:

> On Thu, 2012-11-15 at 09:53 +1300, 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)
>
> I fought with something similar to this a while ago. The key detail that
> I was missing is the difference between gzip and inflate/deflate.  My
> understanding is that they are both implemented in zlib but gzipping
> adds some envelope around the raw deflated data.
>
> I ended up using the IO::Uncompress::RawInflate module because I found a
> code example that worked in my situation (I was dealing with an XML
> document that had been compressed and then base64 encoded and then URL
> encoded).  Despite the 'IO::' prefix, this module does work with
> in-memory strings.  The relevant snippet is here:
>
>
> https://metacpan.org/source/GRANTM/Authen-NZigovt-1.05/lib/Authen/NZigovt/AuthenRequest.pm#L202
>
> Hope that helps
> Grant
>
> _______________________________________________
> Wellington-pm mailing list
> Wellington-pm at pm.org
> http://mail.pm.org/mailman/listinfo/wellington-pm
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/wellington-pm/attachments/20121115/c616c58c/attachment.html>


More information about the Wellington-pm mailing list