This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
write_buildcustomize.pl now test loads the generated lib/buildcustomize.pl
authorNicholas Clark <nick@ccl4.org>
Wed, 12 Jun 2013 13:17:24 +0000 (15:17 +0200)
committerNicholas Clark <nick@ccl4.org>
Thu, 13 Jun 2013 13:19:21 +0000 (15:19 +0200)
And deletes it if it encounters an error whilst loading it. A non-functional
lib/buildcustomize.pl will cause the build to fail with seemingly unrelated
errors. Deleting it and exiting with an error should make the cause of build
failures obvious.

write_buildcustomize.pl

index 709923b..92c75de 100644 (file)
@@ -65,8 +65,12 @@ if ($error) {
     close $fh
         or warn "Can't unlink $file after error: $!";
 } else {
-    close $fh and exit;
-    $error = "Can't close $file: $!";
+    if (close $fh) {
+        do $file and exit;
+        $error = "Can't load generated $file: $@";
+    } else {
+        $error = "Can't close $file: $!";
+    }
 }
 
 # It's going very wrong, so try to remove the botched file.