Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

WinXP & IO::Zlib: binmode issues? or...?

by rkg (Hermit)
on Aug 25, 2003 at 16:47 UTC ( [id://286403]=perlquestion: print w/replies, xml ) Need Help??

rkg has asked for the wisdom of the Perl Monks concerning the following question:

Hi. I am having trouble w/ IO::Zlib on WinXP ActiveState 5.8. The following code spits out a few hundred bytes, garbled, then terminates early (no error). The .gz file is known to be uncorrupted -- and I can extract it successfully with WinZip etc. Is this a binmode issue? If so, how do I set binary mode on the filehandle? Or, what? Thanks!

rkg

use strict; $|++; use IO::Zlib; use Data::Dumper; my $fname = 'xxxxx-access_log.7.gz'; my $fhin = IO::Zlib->new($fname, 'rB') or die $!; die "bad file handle" unless $fhin->can('getline'); while (defined(my $line = $fhin->getline())) { print "$line\n"; }

Replies are listed 'Best First'.
Re: WinXP & IO::Zlib: binmode issues? or...?
by PodMaster (Abbot) on Aug 25, 2003 at 17:31 UTC
    Hmm what you have does not display my entire file either, but the following works perfectly:
    use IO::Zlib; tie *FILE, 'IO::Zlib', "xxxxx-access_log.7.gz", "rb"; print <FILE>; __END__ I wish I were an oscar meyer weiner yeah!
    as does
    use IO::Zlib; my $fh = new IO::Zlib; if ($fh->open("xxxxx-access_log.7.gz", "rb")) { print <$fh>; $fh->close; } __END__
    soooo, I can't tell you what's wrong, but hey ;)

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://286403]
Approved by bart
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (4)
As of 2024-03-29 00:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found