Skip Menu |

This queue is for tickets about the GraphViz CPAN distribution.

Report information
The Basics
Id: 71971
Status: resolved
Priority: 0/
Queue: GraphViz

People
Owner: Nobody in particular
Requestors: RCLAMP [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 2.06
Fixed in: (no value)



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();
Subject: Re: [rt.cpan.org #71971] File::Which used in Makefile.PL
Date: Fri, 28 Oct 2011 09:16:27 +1100
To: bug-GraphViz [...] rt.cpan.org
From: Ron Savage <ron [...] savage.net.au>
Hi Richard On Thu, 2011-10-27 at 05:20 -0400, RCLAMP via RT wrote: Show quoted text
> t/00_has_dot.t
Thanx for the patch. My code was indeed chicken-egg-ish. As I understand the patch, the test dies with 'File::Which not installed', rather than having the makefile die. I guess it would be neater to try loading File::Which, and to output a nice message if it's unavailable. I'll have a think about. -- Ron Savage http://savage.net.au/ Ph: 0421 920 622
Hi Richard Fixed in V 2.07. I've patched Build.PL and Makefile.PL to: eval "require File::Which"; to try loading File::Which before trying to use it.