@INC = '../lib';
}
-use warnings;
+# use warnings;
use strict;
use ExtUtils::MakeMaker;
use ExtUtils::Constant qw (constant_types C_constant XS_constant autoload);
use Config;
-use File::Spec::Functions;
-use File::Spec;
+use File::Spec::Functions qw(catfile rel2abs);
# Because were are going to be changing directory before running Makefile.PL
-my $perl = File::Spec->rel2abs( $^X );
+my $perl;
+$perl = rel2abs( $^X ) unless $] < 5.006; # Hack. Until 5.00503 has rel2abs
# ExtUtils::Constant::C_constant uses $^X inside a comment, and we want to
# compare output to ensure that it is the same. We were probably run as ./perl
# whereas we will run the child with the full path in $perl. So make $^X for
print "# $dir being created...\n";
mkdir $dir, 0777 or die "mkdir: $!\n";
+my $output = "output";
END {
use File::Path;
# Test the code that generates 1 and 2 letter name comparisons.
my %compass = (
-N => 0, NE => 45, E => 90, SE => 135, S => 180, SW => 225, W => 270, NW => 315
+N => 0, 'NE' => 45, E => 90, SE => 135, S => 180, SW => 225, W => 270, NW => 315
);
my $parent_rfc1149 =
print FH <<'EOT';
use strict;
-use warnings;
+EOT
+printf FH "use warnings;\n" unless $] < 5.006;
+print FH <<'EOT';
use Carp;
require Exporter;
require DynaLoader;
-use vars qw ($VERSION @ISA @EXPORT_OK);
+use vars qw ($VERSION @ISA @EXPORT_OK $AUTOLOAD);
$VERSION = '0.01';
@ISA = qw(Exporter DynaLoader);
print FH "use strict;\n";
print FH "use $package qw(@names_only);\n";
-print FH <<'EOT';
+print FH <<"EOT";
+
+print "1..1\n";
+if (open OUTPUT, ">$output") {
+ print "ok 1\n";
+ select OUTPUT;
+} else {
+ print "not ok 1 # Failed to open '$output': $!\n";
+ exit 1;
+}
+EOT
+
+print FH << 'EOT';
+# What follows goes to the temporary file.
# IV
my $five = FIVE;
if ($five == 5) {
EOT
while (my ($point, $bearing) = each %compass) {
- print FH "$point => $bearing, "
+ print FH "'$point' => $bearing, "
}
print FH <<'EOT';
chdir $dir or die $!; push @INC, '../../lib';
END {chdir ".." or warn $!};
-my @perlout = `$runperl Makefile.PL`;
+my @perlout = `$runperl Makefile.PL PERL_CORE=1`;
if ($?) {
print "not ok 1 # $runperl Makefile.PL failed: $?\n";
print "# $_" foreach @perlout;
$make = $ENV{MAKE} if exists $ENV{MAKE};
-if ($^O eq 'MSWin32' && $make =~ /\bnmake\b/) { $make .= " -nologo"; }
+if ($^O eq 'MSWin32' && $make eq 'nmake') { $make .= " -nologo"; }
-my $makeout;
+my @makeout;
print "# make = '$make'\n";
-$makeout = `$make`;
+@makeout = `$make`;
if ($?) {
print "not ok 3 # $make failed: $?\n";
+ print "# $_" foreach @makeout;
exit($?);
} else {
print "ok 3\n";
if ($Config{usedl}) {
print "ok 4\n";
} else {
- push @files, "perl$Config{exe_ext}";
my $makeperl = "$make perl";
print "# make = '$makeperl'\n";
- $makeout = `$makeperl`;
+ @makeout = `$makeperl`;
if ($?) {
print "not ok 4 # $makeperl failed: $?\n";
+ print "# $_" foreach @makeout;
exit($?);
} else {
print "ok 4\n";
}
}
-my $test = 23;
+push @files, $output;
+
my $maketest = "$make test";
print "# make = '$maketest'\n";
-$makeout = `$maketest`;
-# echo of running the test script
-$makeout =~ s/^\s*PERL_DL_NONLAZY=.+?\n//m;
-$makeout =~ s/^MCR.+test.pl\n//mig if $^O eq 'VMS';
+@makeout = `$maketest`;
-# GNU make babblings
-$makeout =~ s/^\w*?make.+?(?:entering|leaving) directory.+?\n//mig;
-
-# Hopefully gets most make's babblings
-# make -f Makefile.aperl perl
-$makeout =~ s/^\w*?make.+\sperl[^A-Za-z0-9]*\n//mig;
-# make[1]: `perl' is up to date.
-$makeout =~ s/^\w*?make.+perl.+?is up to date.*?\n//mig;
+if (open OUTPUT, "<$output") {
+ print while <OUTPUT>;
+ close OUTPUT or print "# Close $output failed: $!\n";
+} else {
+ # Harness will report missing test results at this point.
+ print "# Open <$output failed: $!\n";
+}
-print $makeout;
+my $test = 23;
if ($?) {
print "not ok $test # $maketest failed: $?\n";
+ print "# $_" foreach @makeout;
} else {
print "ok $test\n";
}
my $makeclean = "$make clean";
print "# make = '$makeclean'\n";
-$makeout = `$makeclean`;
+@makeout = `$makeclean`;
if ($?) {
print "not ok $test # $make failed: $?\n";
+ print "# $_" foreach @makeout;
} else {
print "ok $test\n";
}