Make Makefile.PL less irritating.
Tomas Doran [Sat, 26 May 2012 10:47:07 +0000 (11:47 +0100)]
Complain about all the Module::Install extensions in one go.
Do all the author_requires in another go.

This means that if you've got a clean-ish machine, you only get two
irritating lists to feed to cpanm, rather than having to do an
irritating install, perl Makefile.PL, install cycle till it works.

Also fix use of M::I extensions to include parens, as otherwise
if they're not installed then M::I doesn't load them, and our requires
checking is now at runtime rather than compile time (and 5.16.0
doesn't like it at compile time)..

Makefile.PL

index 39a964e..4b83510 100644 (file)
@@ -4,16 +4,26 @@ use inc::Module::Install 0.91;
 # Ensure that these get used - yes, M::I loads them for us, but if you're
 # in author mode and don't have them installed, then the error is tres
 # cryptic.
-use Module::Install::AuthorRequires;
-use Module::Install::CheckConflicts;
-use Module::Install::AuthorTests;
-use Module::Install::Authority;
+if ($Module::Install::AUTHOR) { # We could just use them, but telling
+    my @fail;                   # people the set of things they need nicer
+    foreach my $module (qw/
+        Module::Install::AuthorRequires
+        Module::Install::CheckConflicts
+        Module::Install::AuthorTests
+        Module::Install::Authority
+    /) {
+        push(@fail, $module)
+            unless eval qq{require $module; 1;};
+    }
+    die("Module::Install extensions failed, not installed? \n"
+        . join("\n", map { "  $_" } @fail) . "\n") if @fail;
+}
 
 perl_version '5.008003';
 
 name 'Catalyst-Runtime';
 author 'Sebastian Riedel <sri@cpan.org>';
-authority 'MSTROUT';
+authority('MSTROUT');
 all_from 'lib/Catalyst/Runtime.pm';
 
 requires 'List::MoreUtils';
@@ -68,9 +78,10 @@ test_requires 'Data::Dump';
 test_requires 'HTTP::Request::Common';
 
 # aggregate tests if AGGREGATE_TESTS is set and a recent Test::Aggregate and a Test::Simple it works with is available
+my @author_requires;
 if ($ENV{AGGREGATE_TESTS} && can_use('Test::Simple', '0.88') && can_use('Test::Aggregate', '0.364')) {
-    author_requires('Test::Aggregate', '0.364');
-    author_requires('Test::Simple', '0.88');
+    push(@author_requires, 'Test::Aggregate', '0.364');
+    push(@author_requires, 'Test::Simple', '0.88');
     open my $fh, '>', '.aggregating';
 }
 else {
@@ -78,16 +89,18 @@ else {
     tests 't/*.t t/aggregate/*.t';
 }
 
-author_requires 'CatalystX::LeakChecker', '0.05';
-author_requires 'File::Copy::Recursive'; # For http server test
-author_requires 'Catalyst::Devel', '1.0'; # For http server test
-author_requires 'Catalyst::Engine::PSGI';
-author_requires 'Test::Without::Module';
-author_requires 'Starman';
-author_requires 'MooseX::Daemonize';
-
-author_tests 't/author';
-author_requires(map {; $_ => 0 } qw(
+push(@author_requires, 'CatalystX::LeakChecker', '0.05');
+push(@author_requires, 'Catalyst::Devel', '1.0'); # For http server test
+
+author_tests('t/author');
+author_requires(
+  @author_requires,
+  map {; $_ => 0 } qw(
+  File::Copy::Recursive
+  Catalyst::Engine::PSGI
+  Test::Without::Module
+  Starman
+  MooseX::Daemonize
   Test::NoTabs
   Test::Pod
   Test::Pod::Coverage