Before 'BEGIN not safe', explain why
Chip Salzenberg [Wed, 9 Apr 1997 00:00:00 +0000 (00:00 +0000)]
op.c

diff --git a/op.c b/op.c
index ef2940a..6a1fa5b 100644 (file)
--- 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) {