#!/usr/bin/perl
use Archive::Zip .12;
use Archive::Zip qw(:ERROR_CODES :CONSTANTS);
use IO::Scalar;
my $zip = Archive::Zip->new();
my $member = $zip->addString("hi", "test.txt");
$member->desiredCompressionMethod(COMPRESSION_DEFLATED);
my $data;
$zip->writeToFileHandle(new IO::Scalar(\$data), 0);
print $data;
Archive::Zip considers IO::Scalar an unseekable filehandle, and so is forced to write the compressed size and crc to the data descriptor rather than the local file header.
As a shortcut, test.zip is the result of running the script.
Version .12 of Archive::Zip may be found Ned Konz' site.