X-Git-Url: http://git.maemo.org/git/?p=dh-make-perl;a=blobdiff_plain;f=dev%2Fi386%2Flibarchive-zip-perl%2Flibarchive-zip-perl-1.18%2Fexamples%2FwriteScalar2.pl;fp=dev%2Fi386%2Flibarchive-zip-perl%2Flibarchive-zip-perl-1.18%2Fexamples%2FwriteScalar2.pl;h=407c92847a72a30f25330d1bc19793c0402739e7;hp=0000000000000000000000000000000000000000;hb=8977e561d8a9eae6959218b0306c9df2056a38a9;hpb=df794b845212301ea0d267c919232538bfef356a diff --git a/dev/i386/libarchive-zip-perl/libarchive-zip-perl-1.18/examples/writeScalar2.pl b/dev/i386/libarchive-zip-perl/libarchive-zip-perl-1.18/examples/writeScalar2.pl new file mode 100644 index 0000000..407c928 --- /dev/null +++ b/dev/i386/libarchive-zip-perl/libarchive-zip-perl-1.18/examples/writeScalar2.pl @@ -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(); +