summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2014-08-31 18:20:28 -0700
committerFather Chrysostomos <sprout@cpan.org>2014-08-31 18:20:42 -0700
commitaf26e4f23ae11a43d1a3ac56ed110a974e093811 (patch)
treeb121c20b8fa7d421aa41446ce51fd1e04161e4f5 /perl.c
parent5df8ece29fd957870ec28e269ef416b1536e92d0 (diff)
downloadperl-af26e4f23ae11a43d1a3ac56ed110a974e093811.tar.gz
perl.c: Improve buildcustomize error message
buildcustomize.pl was being loaded with generated code that died if ‘lib/buildcustomize.pl’ existed but do-file failed. $@ was used as the error message. If the file does not exist (do-file searching @INC), then $@ is empty and the error is in $!. Before 9054c817, this is what we would get: $ ./miniperl -T -Ilib -e0 Died. BEGIN failed--compilation aborted. I fixed that in 9054c817 so there would be no error (by adding an ini- tial ‘./’ to the path.) That message was rather baffling. It would have been easier to track down the cause if I had seen something like this: $ ./miniperl -T -Ilib -e0 lib/buildcustomize.pl: No such file or directory. BEGIN failed--compilation aborted. This commit changes the generated code to output $! like that if $@ is empty, in case a similar bug occurs again.
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/perl.c b/perl.c
index 4af534877b..b61e2ffd07 100644
--- a/perl.c
+++ b/perl.c
@@ -2070,10 +2070,9 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit)
it should be reported immediately as a build failure. */
(void)Perl_av_create_and_unshift_one(aTHX_ &PL_preambleav,
Perl_newSVpvf(aTHX_
- "BEGIN { do {local $!; -f q%c./%"SVf
- "/buildcustomize.pl%c} and do q%c./%"SVf
- "/buildcustomize.pl%c || die $@ }",
- 0, SVfARG(*inc0), 0,
+ "BEGIN { my $f = q%c./%"SVf"/buildcustomize.pl%c; "
+ "do {local $!; -f $f }"
+ " and do $f || die $@ || qq '$f: $!' }",
0, SVfARG(*inc0), 0));
}
# else