You can get to the content by using the ->fh method of the entry:
sub _open_sxc_fh($self, $fh, $member, %options) { my $zip = Archive::Zip->new(); my $status = $zip->readFromFileHandle($fh); $status == AZ_OK or croak "Read error from zip"; my $content = $zip->memberNamed($member); if( ! defined $content ) { if( $options{ optional }) { return; } else { croak "Want to read $member' but it doesn't exist!"; } } $content->rewindData(); my $stream = $content->fh; 1 if eof($stream); # reset eof state of $stream?! Is that a bug? W +here? binmode $stream => ':gzip(none)'; return $stream }
The above subroutine gives you a filehandle from which you can read the information. If you want the data directly instead of a filehandle, use the following:
my $mem; my $fh = _open_sxc_fh($self, $zipfh, 'readme.txt'); local $/; my $content = <$fh>; # sluuurp
In reply to Re: Archive::Zip into memory
by Corion
in thread Archive::Zip into memory
by Takamoto
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |