Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Make Makefile.PL be interactive as a last resort

Following feedback from Yitzchak Scott-Thoennes on London.pm,
stop and ask a question if the engine isn't running rather than
panicing and giving up.

Use ExtUtils::MakeMaker::prompt so interactive scripts dtrt
  • Loading branch information...
commit 2e28695b88f220d9173018c9a8701c0970ff2057 1 parent cad3f26
Mark Fowler authored December 06, 2012

Showing 1 changed file with 18 additions and 8 deletions. Show diff stats Hide diff stats

  1. 26  Makefile.PL
26  Makefile.PL
... ...
@@ -1,3 +1,15 @@
  1
+#
  2
+# Attention automated build system engineers:
  3
+# 
  4
+# If you're looking for a way to force the Makefile.PL to be
  5
+# created even if Keyboard Maestro Engine isn't running in an automated
  6
+# way which doesn't require you to answer "y" to the interactive prompt
  7
+# then set the PERL_KM_FORCE enviroment variable to a true value
  8
+#     -- Mark
  9
+#
  10
+
  11
+use ExtUtils::MakeMaker;
  12
+
1 13
 BEGIN {
2 14
 
3 15
 	# indicate for CPAN testers that we only support OS X
@@ -6,7 +18,7 @@ BEGIN {
6 18
 	}
7 19
 
8 20
 	# check that Keyboard Maestro is running and cowardly refuse to
9  
-	# install if it's not
  21
+	# install if it's not.
10 22
 	unless (`ps x` =~ /Keyboard Maestro Engine/ || $ENV{PERL_KM_FORCE}) {
11 23
 		print STDERR <<'BLURB';
12 24
 This module requires Keyboard Maestro to be installed.  The Keboard Maestro
@@ -16,16 +28,14 @@ You can download a version of Keyboard Maestro (with a free trial) from:
16 28
 
17 29
      http://www.keyboardmaestro.com/
18 30
 
19  
-Giving up without creating a Makefile.  Please re-run Makefile.PL once you've
20  
-installed and started Keyboard Maestro Engine.
  31
+If you do not have the Keyboard Maestro Engine running when you "make test"
  32
+then the test suite will fail.
21 33
 
22  
-(If for some reason you really want to install this module without first
23  
-installing Keyboard Maestro and you don't mind the test suite of this module
24  
-failing then set the PERL_KM_FORCE environment variable to true before running
25  
-this Makefile.PL)
26 34
 BLURB
  35
+		my $q = ExtUtils::MakeMaker::prompt("Continue with install (y/n)?","n");
  36
+
27 37
 		# as per http://wiki.cpantesters.org/wiki/CPANAuthorNotes
28  
-		exit 0;
  38
+		exit 0 unless $q =~ /y/i;
29 39
 	}
30 40
 }
31 41
 

1 note on commit 2e28695

Paul Makepeace

"Keboard" -> "Keyboard"

Please sign in to comment.
Something went wrong with that request. Please try again.