in reply to Using compress::zlib output as a filehandle

Now I have adjusted my code to reflect those suggestions but I am still getting errors and some look to be out of my control. The documentation for compress::zlib suggests that gzreadline and not gzread is the thing to use...Here's what I have:
use Compress::Zlib; my $gz = gzopen("$system_config{sendmail_log_dir}$_") || warn "Could n +ot open $system_config{sendmail_log_dir}$_ for reading: $!\n"; my $line; while($gz->gzreadline($line)) { push (@logfile_contents,$line); } $gz->gzclose();
Here are my errors:
Use of uninitialized value in subroutine entry at /usr/lib/perl5/site_perl/5.6.1/i386-linux/Compress/Zlib.pm line 118.

Could not open /home/mjn/perl/logscanner/maillog.2.gz for reading: Bad file descriptor

Can't call method "gzreadline" without a package or object reference at ./logscanner.pl line 36.

Input would be great! Thanks.
_____________________
mjn

Replies are listed 'Best First'.
Re: Re: Using compress::zlib output as a filehandle
by Thelonius (Priest) on Mar 21, 2003 at 17:52 UTC
    You need to read the documentation more carefully. The function gzopen takes two arguments.

    Updated: See the zlib manual for details of mode. For reading you want "rb".