Subject: | File::Which used in Makefile.PL |
There's a little chicken/egg problem with using File::Which in the Makefile.PL and also declaring
that you need it there. If the user doesn't have File::Which installed they can't run the
Makefile.PL to find out that they should have it installed.
The attached patch defers this assertion till test time.
--
Richard Clamp <richardc@unixbeard.net>
Subject: | Graphviz-2.06-File-Which.patch |
commit e50ce7d0a1d60ba9aababd544e32a207ea989329
Author: Richard Clamp <richard.clamp@net-a-porter.com>
Date: Thu Oct 27 10:12:26 2011 +0100
defer testing for dot until after Makefile.PL
as C<perl Makefile.PL> may happen before the user has File::Which installed (as
stated in the Makefile.PL) defer the assertion that we need to have graphviz
installed to the test suite.
diff --git a/Build.PL b/Build.PL
index f1e0daa..9e5c53d 100644
--- a/Build.PL
+++ b/Build.PL
@@ -1,12 +1,5 @@
-use File::Which; # For which().
-
use Module::Build;
-if (! which('dot') )
-{
- die "Did not find 'dot'. Please install graphviz from http://www.graphviz.org/";
-}
-
Module::Build -> new
(
module_name => 'GraphViz',
diff --git a/MANIFEST b/MANIFEST
index 6fef435..723d9e7 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -42,6 +42,7 @@ MANIFEST This list of files
META.json
META.yml
README
+t/00_has_dot.t
t/dumper.t
t/foo.t
t/pod.t
diff --git a/Makefile.PL b/Makefile.PL
index 08d2ae3..1b94cb0 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -4,12 +4,6 @@ use Config;
use ExtUtils::MakeMaker;
-use File::Which; # For which().
-
-if (! which('dot') )
-{
- die "Did not find 'dot'. Please install graphviz from http://www.graphviz.org/";
-}
WriteMakefile
(
diff --git a/t/00_has_dot.t b/t/00_has_dot.t
new file mode 100644
index 0000000..1de0ff1
--- /dev/null
+++ b/t/00_has_dot.t
@@ -0,0 +1,8 @@
+#!perl
+use strict;
+use Test::More;
+use File::Which;
+
+ok(which('dot'), "we have dot")
+ or BAIL_OUT("Did not find 'dot'. Please install graphviz from http://www.graphviz.org/");
+done_testing();