2 # Extracts the named files into 'extractTest' subdir
4 # perl extract.pl [-j] zipfile.zip filename [...]
5 # if -j option given, discards paths.
11 my $dirName = 'extractTest';
13 use vars
qw( $opt_j );
14 use Archive::Zip qw(:ERROR_CODES);
23 usage: perl extract.pl [-j] zipfile.zip filename [...]
24 if -j option given, discards paths.
28 my $zip = Archive
::Zip
->new();
29 my $zipName = shift(@ARGV);
30 my $status = $zip->read( $zipName );
31 die "Read of $zipName failed\n" if $status != AZ_OK
;
33 foreach my $memberName (@ARGV)
35 print "Extracting $memberName\n";
37 ?
$zip->extractMemberWithoutPaths($memberName)
38 : $zip->extractMember($memberName);
39 die "Extracting $memberName from $zipName failed\n" if $status != AZ_OK
;