From 9de57a983b51a4dc9972592ff09edf6281ba105a Mon Sep 17 00:00:00 2001 From: shawnlaffan Date: Wed, 21 Aug 2024 08:13:55 +1000 Subject: [PATCH 1/3] Windows: specify full path to pl2bat if possible Otherwise fall back to the existing behaviour and let the system find it on the path. --- lib/ExtUtils/MM_Win32.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/ExtUtils/MM_Win32.pm b/lib/ExtUtils/MM_Win32.pm index 477f684f2..4f0b464ad 100644 --- a/lib/ExtUtils/MM_Win32.pm +++ b/lib/ExtUtils/MM_Win32.pm @@ -144,6 +144,8 @@ sub init_tools { $self->{FIXIN} ||= $self->{PERL_CORE} ? "\$(PERLRUN) -I$self->{PERL_SRC}\\cpan\\ExtUtils-PL2Bat\\lib $self->{PERL_SRC}\\win32\\bin\\pl2bat.pl" : + -e "$Config{installscript}\\pl2bat.bat" ? + qq{"$Config{installscript}\\pl2bat.bat"} : 'pl2bat.bat'; $self->SUPER::init_tools; From 0309317e96a2e22c33ad2bbd1215cf2e973f9741 Mon Sep 17 00:00:00 2001 From: shawnlaffan Date: Wed, 21 Aug 2024 17:10:57 +1000 Subject: [PATCH 2/3] Convert a ternary to if-else blocks Makes the code somewhat more readable. --- lib/ExtUtils/MM_Win32.pm | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/ExtUtils/MM_Win32.pm b/lib/ExtUtils/MM_Win32.pm index 4f0b464ad..3e5073aa6 100644 --- a/lib/ExtUtils/MM_Win32.pm +++ b/lib/ExtUtils/MM_Win32.pm @@ -142,11 +142,16 @@ sub init_tools { $self->{NOOP} ||= 'rem'; $self->{DEV_NULL} ||= '> NUL'; - $self->{FIXIN} ||= $self->{PERL_CORE} ? - "\$(PERLRUN) -I$self->{PERL_SRC}\\cpan\\ExtUtils-PL2Bat\\lib $self->{PERL_SRC}\\win32\\bin\\pl2bat.pl" : - -e "$Config{installscript}\\pl2bat.bat" ? - qq{"$Config{installscript}\\pl2bat.bat"} : - 'pl2bat.bat'; + if (!$self->{FIXIN}) { + if ($self->{PERL_CORE}) { + my $psrc = $self->{PERL_SRC}; # shorten next line + $self->{FIXIN} = "\$(PERLRUN) -I${psrc}\\cpan\\ExtUtils-PL2Bat\\lib ${psrc}\\win32\\bin\\pl2bat.pl"; + } + else { + my $p2bpath = "$Config{installscript}\\pl2bat.bat"; + $self->{FIXIN} = -e $p2bpath ? qq{"$p2bpath"} : 'pl2bat.bat'; + } + } $self->SUPER::init_tools; From afa6ee75c333238e2724a0fc8191361e51d89d2c Mon Sep 17 00:00:00 2001 From: shawnlaffan Date: Thu, 22 Aug 2024 14:49:24 +1000 Subject: [PATCH 3/3] Win32: Search for pl2bat.bat in the path And specify its full path in the generated Makefile. --- lib/ExtUtils/MM_Win32.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/ExtUtils/MM_Win32.pm b/lib/ExtUtils/MM_Win32.pm index 3e5073aa6..9619c9122 100644 --- a/lib/ExtUtils/MM_Win32.pm +++ b/lib/ExtUtils/MM_Win32.pm @@ -148,8 +148,9 @@ sub init_tools { $self->{FIXIN} = "\$(PERLRUN) -I${psrc}\\cpan\\ExtUtils-PL2Bat\\lib ${psrc}\\win32\\bin\\pl2bat.pl"; } else { - my $p2bpath = "$Config{installscript}\\pl2bat.bat"; - $self->{FIXIN} = -e $p2bpath ? qq{"$p2bpath"} : 'pl2bat.bat'; + my @path = split $Config{path_sep}, $ENV{PATH}; + my @found = grep {-e qq{$_\\pl2bat.bat}} @path; + $self->{FIXIN} = @found ? qq{"$found[0]\\pl2bat.bat"} : "pl2bat.bat"; } }