From 6b4f64afd987c2f14d6c6327b8dd1779b4cd4cdc Mon Sep 17 00:00:00 2001 From: Ricardo Signes Date: Sat, 11 May 2024 21:22:21 -0400 Subject: [PATCH] when writing .zip files, chmod files 0644 ...so that PAUSE will accept them, because it rejects archives with a+w files. Great! But I'm doing this in a horrible way and should look at getting upstream to accept a patch maybe. --- lib/Module/Faker/Dist.pm | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/lib/Module/Faker/Dist.pm b/lib/Module/Faker/Dist.pm index 05c7062..3881403 100644 --- a/lib/Module/Faker/Dist.pm +++ b/lib/Module/Faker/Dist.pm @@ -415,12 +415,34 @@ and true, it will be written under a hashed author dir, like: =cut +package + Module::Faker::Dist::ZipCreator { + + use parent 'Archive::Any::Create::Zip'; + + sub add_file { + my $self = shift; + my($file, $data) = @_; + + my $member = $self->SUPER::add_file($file, $data); + $member->unixFileAttributes(0644); + + return $member; + } +} + sub make_archive { my ($self, $arg) = @_; $arg ||= {}; my $dir = $arg->{dir} || File::Temp::tempdir; + local $Archive::Any::Create::Type2Class{zip} = [ + 'Module::Faker::Dist::ZipCreator' + ]; + + local $INC{'Module/Faker/Dist/ZipCreator.pm'} = 1; + my $archive = Archive::Any::Create->new; my $container = $self->archive_basename;