/usr/share/doc/libarchive-zip-perl/examples/writeScalar.pl is in libarchive-zip-perl 1.60-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #!/usr/bin/perl -w
use strict;
use Archive::Zip qw(:CONSTANTS :ERROR_CODES);
use IO::Scalar;
use IO::File;
# test writing to a scalar
my $zipContents = '';
my $SH = IO::Scalar->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();
|