I am in a Windows environment using cygwin. The zip file has /r/n as a carriage return 
(so annoying). When I ran the script below it dumped out a lot of bizarre chars to the 
screen. I guess this is some of the zip metadata. Using unzip -p zipfile.zip it prints 
cleanly. The doc states:
 "At this time gzreadline ignores the variable $/ ($INPUT_RECORD_SEPARATOR or $RS when 
English is in use). The end of a line is denoted by the C character '\n'."
Do you think this might be throwing the script or did I do something incorrect?
The mode is just from the example. The cpan doc says check out the zlib doc for the 
values, but I have been unable to locate it. perldoc zlib comes up empty.
Should I use binmode? I cannot think how to set that up. It wants a filehandle, but 
you can see I have gzopen'd the filename.

#!/usr/bin/perl -w
use Compress::Zlib;
@ARGV == 1 or die "Usage: $0 input_zip_file\n";
my $gz = gzopen ($ARGV[0], "rb") or die "Cannot open $ARGV[0]: $gzerrno\n";
print $buff while $gz->gzreadline($buff) > 0;
die "Error reading from $ARGV[0]: $gzerrno" . ($gzerrno+0) . "\n"
   if $gzerrno != Z_STREAM_END ;
$gz->gzclose();

Thanks,
John



>>> "Wiggins d'Anconia" <[EMAIL PROTECTED]> 09/25/03 05:45PM >>>

Check out the 'Compress::Zlib' module. In particular the 'gzreadline' method. Much 
better than shelling out to do this sort of thing...

http://danconia.org 



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to