пт, 9 авг. 2019 г. в 05:45, Michael Paquier <mich...@paquier.xyz>: > > On Thu, Aug 08, 2019 at 10:46:07PM +0300, Dmitry Igrishin wrote: > > This looks nice for a Perl hacker :-). As for me, it looks unusual and > > a bit confusing. I never > > programmed in Perl, but I was able to quickly understand where the > > problem lies due to the > > style adopted in other languages, when the contents are enclosed in > > quotation marks, and > > the quotation marks are escaped if they are part of the contents. > > So, should I fix it? Any thoughts? > > FWIW, I like Alvaro's suggestion about qq{} in this case, as it makes > sure that double-quotes are correctly applied where they should. The attached 4rd version of the patch uses qq||. I used qq|| instead of qq{} for consistency because qq|| is already used in Solution.pm:
return qq|VisualStudioVersion = $self->{VisualStudioVersion} MinimumVisualStudioVersion = $self->{MinimumVisualStudioVersion} |;
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm index d1d0aed07e..042879238e 100644 --- a/src/tools/msvc/Mkvcbuild.pm +++ b/src/tools/msvc/Mkvcbuild.pm @@ -495,7 +495,7 @@ sub mkvcbuild my $pythonprog = "import sys;print(sys.prefix);" . "print(str(sys.version_info[0])+str(sys.version_info[1]))"; my $prefixcmd = - $solution->{options}->{python} . "\\python -c \"$pythonprog\""; + qq|"$solution->{options}->{python}\\python" -c "$pythonprog"|; my $pyout = `$prefixcmd`; die "Could not query for python version!\n" if $?; my ($pyprefix, $pyver) = split(/\r?\n/, $pyout); diff --git a/src/tools/msvc/Project.pm b/src/tools/msvc/Project.pm index b5d1dc6e89..88e9e3187d 100644 --- a/src/tools/msvc/Project.pm +++ b/src/tools/msvc/Project.pm @@ -132,11 +132,6 @@ sub AddLibrary { my ($self, $lib, $dbgsuffix) = @_; - if ($lib =~ m/\s/) - { - $lib = '"' . $lib . """; - } - push @{ $self->{libraries} }, $lib; if ($dbgsuffix) { diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm index 318594db5d..6406df6769 100644 --- a/src/tools/msvc/Solution.pm +++ b/src/tools/msvc/Solution.pm @@ -126,7 +126,7 @@ sub GetOpenSSLVersion # Attempt to get OpenSSL version and location. This assumes that # openssl.exe is in the specified directory. my $opensslcmd = - $self->{options}->{openssl} . "\\bin\\openssl.exe version 2>&1"; + qq|"$self->{options}->{openssl}\\bin\\openssl.exe" version 2>&1|; my $sslout = `$opensslcmd`; $? >> 8 == 0