in reply to Re: Reading data from ZIP data in a File::Temp filehandle problem
in thread Reading data from ZIP data in a File::Temp filehandle problem
which didn't appear to affect the issue.###################################################################### # This doesn't { my $ua = LWP::UserAgent->new; $ua->timeout(10); $ua->env_proxy; my $response = $ua->get($url); my $tmp = File::Temp->new(); if ($response->is_success) { binmode($tmp); print $tmp $response->decoded_content; print "Wrote ".$tmp->filename()."\n"; $tmp->seek(0,0); # Added rewind } else { die "error ".$response->status_line; } unless (-B $tmp) { die "Did not get a filehandle\n"; } 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); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Reading data from ZIP data in a File::Temp filehandle problem
by Corion (Patriarch) on Sep 14, 2011 at 19:43 UTC | |
by drewhead (Beadle) on Sep 15, 2011 at 12:32 UTC |