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
|
use 5.010_000;
use ExtUtils::MakeMaker;
if (! usable_gdb()) {
print "App::Stacktrace requires gdb. Aborting installation";
exit 0;
}
WriteMakefile(
ABSTRACT_FROM => 'lib/App/Stacktrace.pm',
AUTHOR => 'Josh Jore <jjore@cpan.org>',
EXE_FILES => [
'bin/perl-stacktrace'
],
$ExtUtils::MakeMaker::VERSION >= 6.30
? (LICENSE => 'perl')
: (),
NAME => 'App::Stacktrace',
VERSION_FROM => 'lib/App/Stacktrace.pm',
);
sub usable_gdb {
require File::Temp;
my $fh = File::Temp->new();
print { $fh } <<SCRIPT;
run -e 1
quit
SCRIPT
$fh->flush;
$fh->sync;
my $fn = $fh->filename;
return 0 == system "gdb -quiet -batch -nx -x $fn $^X >/dev/null 2>&1 </dev/null";
}
|