2ge has asked for the wisdom of the Perl Monks concerning the following question:

Hello all, I have to write CGI script, which read some files from server and create ZIP archive and send this ZIP to client. Problem is, I don't like to save ZIP file to temp file and after read the temp and send it to client. So question is: how to create ZIP file to variable? So far I've this snippet:
use Archive::Zip qw( :ERROR_CODES :CONSTANTS ); my $zip = Archive::Zip->new(); while( my($k,$v) = each(%$hr) ) { my $member = $zip->addString( $v->{content}, $v->{FileName} ); } #here should be a line how to access zipped contents
Thanks for any help, I hope this is possible.

Replies are listed 'Best First'.
Re: create ZIP to variable
by 2ge (Scribe) on Nov 26, 2005 at 17:23 UTC
    ahm, shame on me, I read DOCS, not a FAQ, so: Archive-Zip-1.16\examples\writeScalar.pl :)