Debian lenny version packages
[pkg-perl] / deb-src / libarchive-zip-perl / libarchive-zip-perl-1.18 / examples / unzipAll.pl
1 #!/bin/perl -w
2 # Extracts all files from the given zip
3 # $Revision: 1.3 $
4 # usage:
5 #       perl unzipAll.pl [-j] zipfile.zip
6 # if -j option given, discards paths.
7 #
8 use strict;
9
10 use vars qw( $opt_j );
11 use Archive::Zip qw(:ERROR_CODES);
12 use Getopt::Std;
13
14 $opt_j = 0;
15 getopts('j');
16
17 if (@ARGV < 1)
18 {
19         die <<EOF
20         usage: perl $0 [-j] zipfile.zip
21         if -j option given, discards paths.
22 EOF
23 }
24
25 my $zip = Archive::Zip->new();
26 my $zipName = shift(@ARGV);
27 my $status = $zip->read( $zipName );
28 die "Read of $zipName failed\n" if $status != AZ_OK;
29
30 $zip->extractTree();