/usr/share/perl5/Archive/Any/Create/Zip.pm is in libarchive-any-create-perl 0.3-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 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | package Archive::Any::Create::Zip;
use strict;
use Archive::Zip qw(:ERROR_CODES);
sub init {
my $self = shift;
my($opt) = @_;
$self->{zip} = Archive::Zip->new;
}
sub container {
my $self = shift;
my($dir) = @_;
$self->{container} = $dir;
$self->{zip}->addDirectory("$dir/");
}
sub add_file {
my $self = shift;
my($file, $data) = @_;
$file = "$self->{container}/$file" if $self->{container};
$self->{zip}->addString($data, $file);
}
sub write_file {
my $self = shift;
my($file) = @_;
my $err = $self->{zip}->writeToFileNamed($file);
$err == AZ_OK
or throw Archive::Any::Create::Error(error => "write_file failed ($err)");
1;
}
sub write_filehandle {
my $self = shift;
my($fh) = @_;
my $err = $self->{zip}->writeToFileHandle($fh);
$err == AZ_OK
or throw Archive::Any::Create::Error(error => "write_filehandle failed ($err)");
1;
}
1;
|