Unix compress and uncompress utilities use LZW compression. I don't believe that Zlib handles LZW compression because it is a patented algorithm. It is the same compression algorithm used in GIF images and the source of all the controversy surrounding the use of GIFs.

The gzip tool does handle uncompression of LZW compressed files. I don't think the uncompression algorithm is patented. (Don't take my word on that though.) Zlib likely doesn't bother because its purpose is to provide another compression algorithm not to support uncompression of data compressed with a patented algorithm.

There are a few other compression libraries on CPAN but I don't think any of them support the functionality you need. Your best bet, until someone writes an uncompress module just for this, is to call another program to do it for you like you are already doing.

-sauoq
"My two cents aren't worth a dime.";

In reply to Re: uncompressing a foo.Z file by sauoq
in thread uncompressing a foo.Z file by lostcause

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.