Add ARM files
[dh-make-perl] / dev / arm / libarchive-zip-perl / libarchive-zip-perl-1.18 / debian / libarchive-zip-perl / usr / share / doc / libarchive-zip-perl / examples / writeScalar2.pl
diff --git a/dev/arm/libarchive-zip-perl/libarchive-zip-perl-1.18/debian/libarchive-zip-perl/usr/share/doc/libarchive-zip-perl/examples/writeScalar2.pl b/dev/arm/libarchive-zip-perl/libarchive-zip-perl-1.18/debian/libarchive-zip-perl/usr/share/doc/libarchive-zip-perl/examples/writeScalar2.pl
new file mode 100644 (file)
index 0000000..407c928
--- /dev/null
@@ -0,0 +1,22 @@
+#!/usr/bin/perl -w
+use strict;
+use Archive::Zip qw(:CONSTANTS :ERROR_CODES);
+use IO::String;
+use IO::File;
+
+# test writing to a scalar
+my $zipContents = '';
+my $SH = IO::String->new($zipContents);
+
+my $zip = Archive::Zip->new();
+my $member = $zip->addString('a' x 300, 'bunchOfAs.txt');
+$member->desiredCompressionMethod(COMPRESSION_DEFLATED);
+$member = $zip->addString('b' x 300, 'bunchOfBs.txt');
+$member->desiredCompressionMethod(COMPRESSION_DEFLATED);
+my $status = $zip->writeToFileHandle( $SH );
+
+my $file = IO::File->new('test.zip', 'w');
+binmode($file);
+$file->print($zipContents);
+$file->close();
+