sub fetch_archive { my $path = "path/to/file/"; my $filename = "data.zip"; my $zip = Archive::Zip->new(); $zip->addTree( $path, '' ); print "Content-type: text/plain\n" . "Content-Disposition: attachment;$filename\n\n". $zip->writeToFileHandle( 'STDOUT', 0 ); return Apache::OK; }