There are streaming modules on CPAN that support gzip and Bzip2 and many more based on PerlIO::via, all using syntax like:

# compress open my $fh, ">:via(XXZ)", "test.xxz"; print $fh $text; # decompress open my $fh, "<:via(XXZ)", "test.xxz"; while (<$fh>) { ... }

where XXZ is the required PerlIO::via::XXZ (gzip, Bzip2, ...) and .xxz is the extension that goes with it (.gz, .bz2, ...).

I needed this for xz-(de)compression, but it wasn't there (yet), so I stole from existing modules and whipped up PerlIO::via::xz, which works for what I want.

BUT, it fails in a scope where $/ = undef;, and I have no tuits to investigate.

This has not (yet) been put to CPAN, and to be honest, I don't feel like it (yet).

If anyone thinks this is a good thing to have and wants a kickstart in getting something ready to distribute, please contact me: you're welcome to grab it a use it to make it *your* (first) distribution.


Enjoy, Have FUN! H.Merijn

In reply to PerlIO::via::xz by Tux

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.