From 59547c5f4103d33c352f8559da9654032cc8c44f Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Tue, 17 May 2022 17:20:25 +0300 Subject: [PATCH] Refactoring / code cleanup. See: * https://en.wikipedia.org/wiki/Code_refactoring * https://www.refactoring.com/ * https://www.joelonsoftware.com/2002/01/23/rub-a-dub-dub/ Some small optimisations may have slipped in as well. --- Makefile.PL | 55 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/Makefile.PL b/Makefile.PL index d3ee9d1..079f8ea 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -105,7 +105,7 @@ EOF $config{LIBS} = '-L/usr/local/lib -L/usr/lib -lxslt -lxml2 -lz -lm'; $config{INC} = '-I/usr/local/include -I/usr/include'; - print < "Conftest", VERSION_FROM => "Conftest.pm", %config); EOT _write_utf8_file("test.pl", <<"EOT"); -use Test; BEGIN { plan tests => 1; } END { ok(\$loaded) } -use Conftest; \$loaded++; +use Test::More tests => 1; +use Conftest; +++\$::loaded; +ok(\$::loaded, "loaded") ; EOT xsystem($^X, 'Makefile.PL', map { "$_=$config{$_}" } keys %config); xsystem($Config{make}, @@ -432,8 +434,14 @@ sub try_link { sub have_library { my ($lib, $func) = (@_, "blank"); - printf("checking for %s() in -l%s... ", $func, $lib) if $func ne "blank"; - printf("looking for -l%s... ", $lib) if $func eq "blank"; + if ($func eq "blank") + { + printf("looking for -l%s... ", $lib); + } + else + { + printf("checking for %s() in -l%s... ", $func, $lib); + } my $result; if ($func) { @@ -490,4 +498,3 @@ distruntest: distdir MAKE_FRAG } -