From 720ef322d740c456bfd6430d79cffe48cbe04922 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Sun, 10 Nov 2013 14:31:51 +0100 Subject: [PATCH] Some improvements to Build.PL --- Build.PL | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/Build.PL b/Build.PL index 65bea3222..bf0e5bf53 100644 --- a/Build.PL +++ b/Build.PL @@ -19,6 +19,7 @@ my %prereqs = qw( Moo 1.003001 Scalar::Util 0 Storable 0 + Test::Harness 0 Test::More 0 IO::Scalar 0 Time::HiRes 0 @@ -40,12 +41,12 @@ if ($gui) { ); } -my $missing_prereqs = 0; +my @missing_prereqs = (); if ($ENV{SLIC3R_NO_AUTO}) { foreach my $module (sort keys %prereqs) { my $version = $prereqs{$module}; next if eval "use $module $version; 1"; - $missing_prereqs = 1 if exists $prereqs{$module}; + push @missing_prereqs = $module if exists $prereqs{$module}; print "Missing prerequisite $module $version\n"; } foreach my $module (sort keys %recommends) { @@ -102,7 +103,7 @@ EOF my $res = system $cpanm, "$module~$version"; if ($res != 0) { if (exists $prereqs{$module}) { - $missing_prereqs = 1; + push @missing_prereqs, $module; } else { printf "Don't worry, this module is optional.\n"; } @@ -129,15 +130,15 @@ EOF } } -if ($missing_prereqs) { +if (@missing_prereqs) { + printf "The following prerequisites failed to install: %s\n", join(', ', @missing_prereqs); exit 1; -} else { - my $res = 0; - if (eval "use App::Prove; 1") { - $res = App::Prove->new->run ? 0 : 1; - } - if (!$gui) { +} elsif (!$gui) { + my $res = App::Prove->new->run ? 0 : 1; + if ($res == 0) { print "If you also want to use the GUI you can now run `perl Build.PL --gui` to install the required modules.\n"; + } else { + print "Some tests failed. Please report the failure to the author!\n"; } exit $res; }