Just a quick followup on this thread. The latest version of IO::Compress::Zip now has the ability to rename zip members on the fly using the FilterName option.
Here is the proof-of-concept from before updated to include FilterName
use IO::Compress::Zip qw(:all) ;
select STDOUT;
$| = 1;
my $OUT = \*STDOUT;
print <<EOM;
Status: 200 OK
Content-Type: application/zip
Transfer-Encoding: chunked
EOM
my @files = qw(/tmp/file1 /tmp/file2) ;
zip [@files] => '-',
FilterName => sub
{
if ($DLWOSC eq "checked"){
$_=(split('/',$_))[-1];
s/\;/\_/g;
}
},
FilterEnvelope => sub
{
# Chunk the output
my $length = length($_);
$_ = sprintf("%x", $length) . "\r\n" . $_ . "\r\n";
$_ .= "\r\n" unless $length;
1;
}
;