Fix running Makefile.PL without '.' in @INC
[dbsrgits/DBIx-Class-Schema-Loader.git] / Makefile.PL
index dae8d9d..8f296f1 100644 (file)
@@ -2,6 +2,7 @@ use warnings;
 use strict;
 
 use 5.008001;
+use lib '.';
 use inc::Module::Install 1.00;
 
 use Getopt::Long();
@@ -84,8 +85,16 @@ See also the "Changes" file for the last few revisions.
 EOF
 
 if ($Module::Install::AUTHOR && ! $args->{skip_author_deps}) {
-    eval { require Module::Install::ReadmeFromPod }
-        or die "\nYou need Module::Install::ReadmeFromPod installed to run this Makefile.PL in author mode:\n\n$@\n";
+    my @missing_plugins;
+    for my $plugin (qw(ReadmeFromPod AuthorTests)) {
+        eval "require Module::Install::$plugin" and next;
+        push @missing_plugins, "Module::Install::$plugin";
+        chomp(my $err = $@);
+        $missing_plugins[-1] .= " ($err)"
+            unless $err =~ m{^Can't locate Module/Install/$plugin.pm in \@INC};
+    }
+    die "\nYou need to install the following modules to run this Makefile.PL in author mode:\n\n", join("\n", @missing_plugins), "\n\n"
+        if @missing_plugins;
 
     warn "\n*** AUTHOR MODE: some optional dependencies converted to hard requires.\n\n";
 
@@ -104,6 +113,14 @@ if ($Module::Install::AUTHOR && ! $args->{skip_author_deps}) {
     author_tests( 'xt' );
     readme_from( 'lib/DBIx/Class/Schema/Loader.pm' );
     realclean_files( qw[README MANIFEST lib/DBIx/Class/Schema/Loader/Optional/Dependencies.pod] );
+    postamble <<EOP;
+create_distdir: author_stop_distdir_creation
+author_stop_distdir_creation:
+\t\$(NOECHO) \$(ECHO) Creation of dist with author mode deps not allowed
+\t\$(NOECHO) \$(ECHO) Please re-run Makefile.PL with --skip_author_deps
+\t\$(NOECHO) \$(FALSE)
+EOP
+
 }
 
 tests_recursive;