Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

ajt (2546)

ajt
  (email not shown publicly)
http://www.iredale.net/

UK based. Perl, XML/HTTP, SAP, Debian hacker.

  • CPAN: ATRICKETT [cpan.org]
  • PerlMonks: ajt [perlmonks.org]
  • Local LUG: AdamTrickett [lug.org.uk]
  • Debian Administration: ajt [debian-adm...ration.org]
  • LinkedIn: drajt [linkedin.com]

Journal of ajt (2546)

Thursday April 16, 2009
03:02 AM

PerlIO::gzip intermittent failure...

[ #38815 ]

Yesterday I spent a few hours banging my head against a brick wall. I'm using PerlIO::gzip on ActiveState Perl 5.8.8 to decompress a large XML file. The XML file decompresses perfectly with Cygwin's gzip or xmllint, but PerlIO::gzip sometimes mangles the file and it starts as XML then degenerates into soup and sometimes it decompresses the file perfectly.

I wasted quite a few hours thinking it was something else, but it's clearly a random problem with PerlIO::gzip, sometimes it works and sometimes it doesn't. I can't make any sense of it, how can it work some of the time and the rest of the time it generates gibberish?

I'm going to give IO::Uncompress::Gnuzip a go now to see if it's consistent and reliable. It's a shame as the PerlIO::gzip interface was very handy.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • it's clearly a random problem with PerlIO::gzip, sometimes it works and sometimes it doesn't. I can't make any sense of it, how can it work some of the time and the rest of the time it generates gibberish? yet you say I'm going to give IO::Uncompress::Gnuzip a go now to see if it's consistent and reliable.

    So, I infer, the cause of the observed problem is not clearly anything, as you don't yet have data ruling out other possible causes, because you've not yet tried the experiment of keeping everything else

    • Originally I thought that the same compressed file and the same Perl script could be run time after time and some of the time it would and some of the time it would not work. That really confused me, but it's a Windows box with an old version of ActiveState Perl on it, so I'm not expecting perfection.

      I now think that some files can and some can't be processed. Once you have a "bad" compressed file PerlIO::gzip can't deal with it, but other methods can.

      IO::Compress::Gunzip does work with the same file that

      --
      -- "It's not magic, it's work..."
  • Hi

    This symptom normally means there's a bug in the code, in that some variable is uninitialized, and when used causes various results, depending on the value which happens to be in it.