1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
#!perl
use strict;
use warnings;
use Config;
use ExtUtils::MakeMaker;
use File::Spec::Functions;
print "Looking for dot... ";
my $found = find("dot");
if ($found) {
print "found it at $found\n";
} else {
print "didn't find it\n";
die "****************************************************************
GraphViz.pm has not been able to find the graphviz program 'dot'
GraphViz.pm needs graphviz to function
Please install graphviz first: http://www.graphviz.org/
****************************************************************\n";
}
WriteMakefile(
'NAME' => 'GraphViz',
'VERSION_FROM' => 'lib/GraphViz.pm',
'LICENSE' => 'perl',
'AUTHOR' => 'Leon Brocard <acme@astray.com>',
'ABSTRACT' => 'Interface to the GraphViz graphing tool',
'PREREQ_PM' => {
'IPC::Run' => 0.6,
'Test::More' => 0,
},
'dist' => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
);
sub find {
my $binary = shift;
my $path = join ', ', @ENV{PATH};
my $path_sep = $Config{path_sep};
my $exe_ext = $Config{exe_ext};
foreach my $dir ( split $path_sep, @ENV{PATH} ) {
my $filename = catfile( $dir, $binary );
return $filename if -x "$filename$exe_ext";
}
return 0;
}
|