X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=dev%2Fi386%2Flibarchive-zip-perl%2Flibarchive-zip-perl-1.18%2Fexamples%2Fextract.pl;fp=dev%2Fi386%2Flibarchive-zip-perl%2Flibarchive-zip-perl-1.18%2Fexamples%2Fextract.pl;h=4425ab4bd16df88a580c9714dfd5cf84b9033a51;hb=8977e561d8a9eae6959218b0306c9df2056a38a9;hp=0000000000000000000000000000000000000000;hpb=df794b845212301ea0d267c919232538bfef356a;p=dh-make-perl diff --git a/dev/i386/libarchive-zip-perl/libarchive-zip-perl-1.18/examples/extract.pl b/dev/i386/libarchive-zip-perl/libarchive-zip-perl-1.18/examples/extract.pl new file mode 100644 index 0000000..4425ab4 --- /dev/null +++ b/dev/i386/libarchive-zip-perl/libarchive-zip-perl-1.18/examples/extract.pl @@ -0,0 +1,40 @@ +#!/bin/perl -w +# Extracts the named files into 'extractTest' subdir +# usage: +# perl extract.pl [-j] zipfile.zip filename [...] +# if -j option given, discards paths. +# +# $Revision: 1.5 $ +# +use strict; + +my $dirName = 'extractTest'; + +use vars qw( $opt_j ); +use Archive::Zip qw(:ERROR_CODES); +use Getopt::Std; + +$opt_j = 0; +getopts('j'); + +if (@ARGV < 2) +{ + die <new(); +my $zipName = shift(@ARGV); +my $status = $zip->read( $zipName ); +die "Read of $zipName failed\n" if $status != AZ_OK; + +foreach my $memberName (@ARGV) +{ + print "Extracting $memberName\n"; + $status = $opt_j + ? $zip->extractMemberWithoutPaths($memberName) + : $zip->extractMember($memberName); + die "Extracting $memberName from $zipName failed\n" if $status != AZ_OK; +}