Change $/ = "\xff\xfe\xff\xfe" x 16 to undef in t/10-xz.t. (trice).

sandbox/xz-undef.pl shows it is not the underlying IO modules to blame.

$ perl -Mblib -MPerlIO::via::xz -wE'open my $fh, "<:via(xz)", "files/p +lain.xz";print scalar<$fh>' Lorem ipsum dolor sit amet, consectetur adipiscing elit, $ perl -Mblib -MPerlIO::via::xz -wE'open my $fh, "<:via(xz)", "files/p +lain.xz";$/=undef;print scalar<$fh>'

or replace t/10-xz.t with this:

# Tests for PerlIO::via::xz use 5.12.0; use warnings; use Test::More; use File::Copy; use_ok ("PerlIO::via::xz"); my $txz = "test.xz"; END { unlink $txz } my %txt; my %xz; for my $type (qw( plain banner )) { local $/; open my $fh, "<", "files/$type.txt" or die "$type.txt: $!\n"; $txt{$type} = <$fh>; close $fh; open $fh, "<", "files/$type.xz" or die "$type.xz: $!\n"; $xz{$type} = <$fh>; close $fh; } # Check defaults #cmp_ok(PerlIO::via::xz->level, "==", 1, "default worklevel"); my $fh; # Opening/closing ok ( open ($fh, "<:via(xz)", "files/plain.xz"), "open for read +ing"); ok ( close ($fh), "close file"); ok (!open ($fh, "+<:via(xz)", "files/plain.xz"), "read+write is + impossible"); ok ( open ($fh, ">:via(xz)", $txz), "open for writ +e"); ok ( close ($fh), "close file"); ok (!open ($fh, "+>:via(xz)", $txz), "write+read is + impossible"); ok (!open ($fh, ">>:via(xz)", $txz), "append is not + supported"); foreach my $rs ("\xff\xfe\xff\xfe" x 16, undef) { local $/ = $rs; # Decompression for my $type (qw( plain banner )) { ok (open (my $fz, "<:via(xz)", "files/$type.xz"), "Open $type" +); is (scalar <$fz>, $txt{$type}, "$type decompression"); } # Compression for my $type (qw( plain banner )) { my $fh; ok (open ($fh, ">:via(xz)", $txz), "Open $type compress"); ok ((print { $fh } $txt{$type}), "Write"); ok (close ($fh), "Close"); } # Roundtrip for my $type (qw( plain banner )) { my $fh; ok (open ($fh, ">:via(xz)", $txz), "Open $type compress"); ok ((print { $fh } $txt{$type}), "Write"); ok (close ($fh), "Close"); ok (open ($fh, "<:via(xz)", $txz), "Open $type uncompress"); is (scalar <$fh>, $txt{$type}, "Compare"); } } done_testing;

Enjoy, Have FUN! H.Merijn

In reply to Re^2: PerlIO::via::xz by Tux
in thread 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.