From 9ccaaa961032a69755cae1cc29e3fb9561501521 Mon Sep 17 00:00:00 2001 From: Leon Timmermans Date: Thu, 11 Oct 2018 15:07:49 +0200 Subject: [PATCH 1/2] Write generated files as binary They're already explicitly encoded. --- lib/App/ModuleBuildTiny.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/App/ModuleBuildTiny.pm b/lib/App/ModuleBuildTiny.pm index 4c8345e..9f8bf4a 100644 --- a/lib/App/ModuleBuildTiny.pm +++ b/lib/App/ModuleBuildTiny.pm @@ -200,7 +200,7 @@ my %actions = ( my $dist = App::ModuleBuildTiny::Dist->new(regenerate => \%files); for my $filename ($dist->files) { - write_text($filename, $dist->get_file($filename)) if $dist->is_generated($filename); + write_binary($filename, $dist->get_file($filename)) if $dist->is_generated($filename); } return 0; }, From 52ff39d2b4a99f868ee1350e8cd861e1fc8982ef Mon Sep 17 00:00:00 2001 From: Leon Timmermans Date: Thu, 11 Oct 2018 15:09:14 +0200 Subject: [PATCH 2/2] Decode author names when POD is encoded --- lib/App/ModuleBuildTiny/Dist.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/App/ModuleBuildTiny/Dist.pm b/lib/App/ModuleBuildTiny/Dist.pm index 96d64d1..248ec81 100644 --- a/lib/App/ModuleBuildTiny/Dist.pm +++ b/lib/App/ModuleBuildTiny/Dist.pm @@ -129,6 +129,9 @@ sub new { require Module::Metadata; Module::Metadata->VERSION('1.000009'); my $data = Module::Metadata->new_from_file($filename, collect_pod => 1) or die "Couldn't analyse $filename: $!"; my @authors = map { / \A \s* (.+?) \s* \z /x } grep { /\S/ } split /\n/, $data->pod('AUTHOR') // $data->pod('AUTHORS') // '' or warn "Could not parse any authors from `=head1 AUTHOR` in $filename"; + if (read_binary($filename) =~ /^=encoding utf8$/m) { + $_ = decode_utf8($_) for @authors; + } my $license = detect_license($data, $filename, \@authors); my $load_meta = !%{ $opts{regenerate} || {} } && uptodate('META.json', 'cpanfile', $mergefile);