in reply to IO::Compress::Gzip blank output
If you want to use this on an input file that is too big to fit in memory all at once, just use the normal I/O idiom with a while loop -- the result will be the same:#!/usr/bin/perl use strict; use warnings; use PerlIO::gzip; my $Usage = "Usage: $0 filename-to-compress\n"; die $Usage unless ( @ARGV == 1 and -f $ARGV[0] ); open( IN, "<", $ARGV[0] ) or die "$ARGV[0]: $!\n"; open( GZIP, ">:gzip", "$ARGV[0].gz" ) or die "$ARGV[0].gz: $!\n"; $/ = undef; $_ = <IN>; print GZIP;
# $/ = undef; # leave $/ at it's default value... while (<IN>) { print GZIP; }
UPDATE: (2010-10-18) It seems that PerlIO::gzip should be viewed as superseded by PerlIO::via:gzip. (see PerlIO::gzip or PerlIO::via::gzip).
|
---|