Add ARM files
[dh-make-perl] / dev / arm / libarchive-zip-perl / libarchive-zip-perl-1.18 / examples / copy.pl
diff --git a/dev/arm/libarchive-zip-perl/libarchive-zip-perl-1.18/examples/copy.pl b/dev/arm/libarchive-zip-perl/libarchive-zip-perl-1.18/examples/copy.pl
new file mode 100644 (file)
index 0000000..7cc3823
--- /dev/null
@@ -0,0 +1,17 @@
+# Copies a zip file to another.
+# Usage:
+# perl copy.pl input.zip output.zip
+# $Revision: 1.4 $
+
+use Archive::Zip qw(:ERROR_CODES);
+
+die "usage: perl copy.pl input.zip output.zip\n"
+       if scalar(@ARGV) != 2;
+
+my $zip = Archive::Zip->new();
+
+my $status = $zip->read($ARGV[0]);
+die("read $ARGV[0] failed: $status\n") if $status != AZ_OK;
+
+$status = $zip->writeToFileNamed($ARGV[1]);
+die("writeToFileNamed $ARGV[1] failed: $status\n") if $status != AZ_OK;