Closed zmughal closed 1 year ago
It seems that the following script prints "match" and "not match" on perl 5.16 or lower:
#!/usr/bin/env perl
use strict;
use warnings;
print( "x" =~ // ? "match\n" : "not match\n" );
my $module_name = "Foo-Bar";
$module_name =~ s/-/::/g;
print( "x" =~ // ? "match\n" : "not match\n" );
And this was changed in perl 5.18 (see https://github.com/Perl/perl5/issues/11549).
Due to this,
qr//
in find(qr//, 'share')
at https://github.com/miyagawa/cpanminus/blob/devel/Menlo/lib/Menlo/Builder/Static.pm#L51
may be qr/-/
which is the successful pattern at https://github.com/miyagawa/cpanminus/blob/devel/Menlo-Legacy/lib/Menlo/CLI/Compat.pm#L1990
So Menlo::Builder::Static may not find share or script files on perl 5.16 or lower.
I think the following patch fixes this issue:
diff --git Menlo/lib/Menlo/Builder/Static.pm Menlo/lib/Menlo/Builder/Static.pm
index 574fbdf..73e4616 100644
--- Menlo/lib/Menlo/Builder/Static.pm
+++ Menlo/lib/Menlo/Builder/Static.pm
@@ -47,8 +47,8 @@ my %actions = (
build => sub {
my %opt = @_;
my %modules = map { $_ => catfile('blib', $_) } find(qr/\.p(?:m|od)$/, 'lib');
- my %scripts = map { $_ => catfile('blib', $_) } find(qr//, 'script');
- my %shared = map { $_ => catfile(qw/blib lib auto share dist/, $opt{meta}->name, abs2rel($_, 'share')) } find(qr//, 'share');
+ my %scripts = map { $_ => catfile('blib', $_) } find(qr/(?^:)/, 'script');
+ my %shared = map { $_ => catfile(qw/blib lib auto share dist/, $opt{meta}->name, abs2rel($_, 'share')) } find(qr/(?^:)/, 'share');
pm_to_blib({ %modules, %scripts, %shared }, catdir(qw/blib lib auto/));
make_executable($_) for values %scripts;
mkpath(catdir(qw/blib arch/), $opt{verbose});
This code is a copy/fork of Module::Build::Tiny so it would be best to fix there first.
I'm not sure why this is happening, but I wanted to make sure it got recorded somewhere:
Under the 5.16 Docker, the build fails because the share dir file
prefix.cc
is not copied:while under 5.18 Docker, it is:
It appears that both the
share/
andscript/
directories are not being processed under Perl 5.16.My current workaround is to use the
--no-static-install
flag.Connects with https://github.com/kjetilk/URI-NamespaceMap/pull/19.