summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChip Salzenberg <chip@perl.com>1997-04-09 00:00:00 +0000
committerChip Salzenberg <chip@atlantic.net>1997-04-09 00:00:00 +0000
commit6d4c2119f5cbed48a635a73f723f5d62428daf0a (patch)
treea3a8bb33198a6e100a2b8728768bdbbf635e1880
parent4e5f255bc79a4d332832eda907f7e26f656b7ec2 (diff)
downloadperl-6d4c2119f5cbed48a635a73f723f5d62428daf0a.tar.gz
Before 'BEGIN not safe', explain why
-rw-r--r--op.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/op.c b/op.c
index ef2940a01c..6a1fa5b216 100644
--- a/op.c
+++ b/op.c
@@ -3270,8 +3270,17 @@ OP *block;
if (name) {
char *s = strrchr(name, ':');
s = s ? s+1 : name;
- if (strEQ(s, "BEGIN"))
- croak("BEGIN not safe after errors--compilation aborted");
+ if (strEQ(s, "BEGIN")) {
+ char *not_safe =
+ "BEGIN not safe after errors--compilation aborted";
+ if (in_eval & 4)
+ croak(not_safe);
+ else {
+ /* force display of errors found but not reported */
+ sv_catpv(GvSV(errgv), not_safe);
+ croak("%s", SvPVx(GvSV(errgv), na));
+ }
+ }
}
}
if (!block) {