Annotation of annozilla/src/zip.pl, revision 1.1

1.1     ! matthew     1: #!/bin/perl -w
        !             2: # Taken from the Archive::Zip distribution examples/ directory.
        !             3: # Creates a zip file, adding the given directories and files.
        !             4: # Usage:
        !             5: #      perl zip.pl zipfile.zip file [...]
        !             6: 
        !             7: use strict;
        !             8: use Archive::Zip qw(:ERROR_CODES :CONSTANTS);
        !             9: 
        !            10: die "usage: $0 zipfile.zip file [...]\n"
        !            11:        if (scalar(@ARGV) < 2);
        !            12: 
        !            13: my $zipName = shift(@ARGV);
        !            14: my $zip = Archive::Zip->new();
        !            15: 
        !            16: foreach my $memberName (map { glob } @ARGV)
        !            17: {
        !            18:        if (-d $memberName )
        !            19:        {
        !            20:                warn "Can't add tree $memberName\n"
        !            21:                        if $zip->addTree( $memberName, $memberName ) != AZ_OK;
        !            22:        }
        !            23:        else
        !            24:        {
        !            25:                $zip->addFile( $memberName )
        !            26:                        or warn "Can't add file $memberName\n";
        !            27:        }
        !            28: }
        !            29: 
        !            30: foreach my $member ($zip->members()) {
        !            31:     $member->unixFileAttributes(0666);
        !            32: }
        !            33: 
        !            34: my $status = $zip->writeToFileNamed($zipName);
        !            35: exit $status;
        !            36: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>