Before I open a ticket for Archive::Extract, I was wondering if anyone could double-check me.
When using Archive::Extract to extract large gzipped files (.gz), I'm receiving an "Out of Memory" error. (Note: I'm setting $Archive::Extract::PREFER_BIN to 1 to prefer using system binaries.)
Example code:
use Archive::Extract; $Archive::Extract::PREFER_BIN = 1; my $ae = Archive::Extract->new( archive => 'big.txt.gz' ); $ae->extract( to => 'big.txt');
Looking at the module, it looks as if it runs gzip with '-c' (write to STDOUT) and captures the output in a buffer. The buffer is then written to a filehandle. Here's where I need the double-check.
sub _gunzip_bin { my $self = shift; ### check for /bin/gzip -- we need it ### unless( $self->bin_gzip ) { $self->_error(loc("No '%1' program found", '/bin/gzip')); return METHOD_NA; } my $fh = FileHandle->new('>'. $self->_gunzip_to) or return $self->_error(loc("Could not open '%1' for writing: %2" +, $self->_gunzip_to, $! )); my $cmd = [ $self->bin_gzip, '-cdf', $self->archive ]; my $buffer; unless( scalar run( command => $cmd, verbose => $DEBUG, buffer => \$buffer ) ) { return $self->_error(loc("Unable to gunzip '%1': %2", $self->archive, $buffer)); } ### no buffers available? if( !IPC::Cmd->can_capture_buffer and !$buffer ) { $self->_error( $self->_no_buffer_content( $self->archive ) ); } $self->_print($fh, $buffer) if defined $buffer; close $fh; ### set what files where extract, and where they went ### $self->files( [$self->_gunzip_to] ); $self->extract_path( File::Spec->rel2abs(cwd()) ); return 1; }
As far as I can tell, it's not happening with the other methods of compression. It looks like gzipped files are the only ones handled this way.
Thank you!
Casey
In reply to Archive::Extract - Out of Memory by cmilfo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |