I added my $tmp = IO::File->new( 'test1.zip', 'r' ); straight from the Archive::Zip documentation for readFromFileHandle() at cpan to open a filehandle and it works. I tried first with open() and got an error from Archive::Zip that the file must be seekable. Then in the documentation it mentions it must be seekable. I didn't realize there was a difference.
use strict; use warnings; use Archive::Zip qw( :ERROR_CODES :CONSTANTS ); use Data::Dumper; my $tmp = IO::File->new( 'test1.zip', 'r' ); my $zip = Archive::Zip->new(); my $zip_err = $zip->readFromFileHandle( $tmp ); unless ($zip_err == AZ_OK ) { die "Archive::Zip read error on filehandle: $zip_err\n"; } foreach my $member ($zip->members()) { my $fileName = $member->fileName(); print "fileName = $fileName\n"; my $content = $member->contents(); print "contents $fileName = ".Dumper($content); }
In reply to Re: Reading data from ZIP data in a File::Temp filehandle problem
by Lotus1
in thread Reading data from ZIP data in a File::Temp filehandle problem
by drewhead
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |