<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl
# Example of how to compute compressed sizes
# $Revision: 1.2 $
use strict;
use Archive::Zip qw(:ERROR_CODES);
use File::Spec;
my $zip             = Archive::Zip-&gt;new();
my $blackHoleDevice = File::Spec-&gt;devnull();

$zip-&gt;addFile($_) foreach (&lt;*.pl&gt;);

# Write and throw the data away.
# after members are written, the writeOffset will be set
# to the compressed size.
$zip-&gt;writeToFileNamed($blackHoleDevice);

my $totalSize           = 0;
my $totalCompressedSize = 0;
foreach my $member ($zip-&gt;members()) {
    $totalSize           += $member-&gt;uncompressedSize;
    $totalCompressedSize += $member-&gt;_writeOffset;
    print "Member ", $member-&gt;externalFileName,
      " size=",         $member-&gt;uncompressedSize,
      ", writeOffset=", $member-&gt;_writeOffset,
      ", compressed=",  $member-&gt;compressedSize,
      "\n";
}

print "Total Size=", $totalSize, ", total compressed=", $totalCompressedSize,
  "\n";

$zip-&gt;writeToFileNamed('test.zip');
</pre></body></html>