2
# Creates a zip file, adding the given directories and files.
4
# perl zip.pl zipfile.zip file [...]
7
use Archive::Zip qw(:ERROR_CODES :CONSTANTS);
9
die "usage: $0 zipfile.zip file [...]\n"
10
if (scalar(@ARGV) < 2);
12
my $zipName = shift(@ARGV);
13
my $zip = Archive::Zip->new();
15
foreach my $memberName (map { glob } @ARGV)
19
warn "Can't add tree $memberName\n"
20
if $zip->addTree( $memberName, $memberName ) != AZ_OK;
24
$zip->addFile( $memberName )
25
or warn "Can't add file $memberName\n";
29
my $status = $zip->writeToFileNamed($zipName);