New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error from exit in BEGIN {} #896
Comments
From mjtg@cus.cam.ac.ukIs the error message appropriate in this case? The description in =item Callback called exit (F) A subroutine invoked from an external package via perl_call_sv() Mike Guy %perl -V Characteristics of this binary (from libperl): |
From @gsarOn Fri, 26 Nov 1999 16:44:37 GMT, "M.J.T. Guy" wrote:
I think the error is rather misguided for explicit exits. It is also It may even be better to turn it into an optional warning for Sarathy Inline Patch-----------------------------------8<-----------------------------------
Change 4609 by gsar@auger on 1999/12/01 18:43:49
avoid "Callback called exit" error on intentional exit()
Affected files ...
... //depot/perl/embedvar.h#83 edit
... //depot/perl/intrpvar.h#54 edit
... //depot/perl/objXSUB.h#83 edit
... //depot/perl/perl.c#196 edit
... //depot/perl/perl.h#203 edit
... //depot/perl/pp_ctl.c#165 edit
Differences ...
==== //depot/perl/embedvar.h#83 (text+w) ====
Index: perl/embedvar.h
--- perl/embedvar.h.~1~ Wed Dec 1 10:43:52 1999
+++ perl/embedvar.h Wed Dec 1 10:43:52 1999
@@ -241,6 +241,7 @@
#define PL_eval_root (PERL_GET_INTERP->Ieval_root)
#define PL_eval_start (PERL_GET_INTERP->Ieval_start)
#define PL_evalseq (PERL_GET_INTERP->Ievalseq)
+#define PL_exit_flags (PERL_GET_INTERP->Iexit_flags)
#define PL_exitlist (PERL_GET_INTERP->Iexitlist)
#define PL_exitlistlen (PERL_GET_INTERP->Iexitlistlen)
#define PL_expect (PERL_GET_INTERP->Iexpect)
@@ -506,6 +507,7 @@
#define PL_eval_root (vTHX->Ieval_root)
#define PL_eval_start (vTHX->Ieval_start)
#define PL_evalseq (vTHX->Ievalseq)
+#define PL_exit_flags (vTHX->Iexit_flags)
#define PL_exitlist (vTHX->Iexitlist)
#define PL_exitlistlen (vTHX->Iexitlistlen)
#define PL_expect (vTHX->Iexpect)
@@ -908,6 +910,7 @@
#define PL_eval_root (aTHXo->interp.Ieval_root)
#define PL_eval_start (aTHXo->interp.Ieval_start)
#define PL_evalseq (aTHXo->interp.Ievalseq)
+#define PL_exit_flags (aTHXo->interp.Iexit_flags)
#define PL_exitlist (aTHXo->interp.Iexitlist)
#define PL_exitlistlen (aTHXo->interp.Iexitlistlen)
#define PL_expect (aTHXo->interp.Iexpect)
@@ -1174,6 +1177,7 @@
#define PL_Ieval_root PL_eval_root
#define PL_Ieval_start PL_eval_start
#define PL_Ievalseq PL_evalseq
+#define PL_Iexit_flags PL_exit_flags
#define PL_Iexitlist PL_exitlist
#define PL_Iexitlistlen PL_exitlistlen
#define PL_Iexpect PL_expect
==== //depot/perl/intrpvar.h#54 (text) ====
Index: perl/intrpvar.h
--- perl/intrpvar.h.~1~ Wed Dec 1 10:43:52 1999
+++ perl/intrpvar.h Wed Dec 1 10:43:52 1999
@@ -56,6 +56,7 @@
/* top fd to pass to subprocesses */
PERLVAR(Imultiline, int) /* $*--do strings hold >1 line? */
PERLVAR(Istatusvalue, I32) /* $? */
+PERLVAR(Iexit_flags, U8) /* was exit() unexpected, etc. */
#ifdef VMS
PERLVAR(Istatusvalue_vms,U32)
#endif
==== //depot/perl/objXSUB.h#83 (text+w) ====
Index: perl/objXSUB.h
--- perl/objXSUB.h.~1~ Wed Dec 1 10:43:52 1999
+++ perl/objXSUB.h Wed Dec 1 10:43:52 1999
@@ -148,6 +148,8 @@
#define PL_eval_start (*Perl_Ieval_start_ptr(aTHXo))
#undef PL_evalseq
#define PL_evalseq (*Perl_Ievalseq_ptr(aTHXo))
+#undef PL_exit_flags
+#define PL_exit_flags (*Perl_Iexit_flags_ptr(aTHXo))
#undef PL_exitlist
#define PL_exitlist (*Perl_Iexitlist_ptr(aTHXo))
#undef PL_exitlistlen
==== //depot/perl/perl.c#196 (text) ====
Index: perl/perl.c
--- perl/perl.c.~1~ Wed Dec 1 10:43:52 1999
+++ perl/perl.c Wed Dec 1 10:43:52 1999
@@ -1406,7 +1406,7 @@
/* my_exit() was called */
PL_curstash = PL_defstash;
FREETMPS;
- if (PL_statusvalue)
+ if (PL_statusvalue && !(PL_exit_flags & PERL_EXIT_EXPECTED))
Perl_croak(aTHX_ "Callback called exit");
my_exit_jump();
/* NOTREACHED */
@@ -1530,7 +1530,7 @@
/* my_exit() was called */
PL_curstash = PL_defstash;
FREETMPS;
- if (PL_statusvalue)
+ if (PL_statusvalue && !(PL_exit_flags & PERL_EXIT_EXPECTED))
Perl_croak(aTHX_ "Callback called exit");
my_exit_jump();
/* NOTREACHED */
@@ -3169,7 +3169,7 @@
PL_curstash = PL_defstash;
PL_curcop = &PL_compiling;
CopLINE_set(PL_curcop, oldline);
- if (PL_statusvalue) {
+ if (PL_statusvalue && !(PL_exit_flags & PERL_EXIT_EXPECTED)) {
if (paramList == PL_beginav)
Perl_croak(aTHX_ "BEGIN failed--compilation aborted");
else
==== //depot/perl/perl.h#203 (text) ====
Index: perl/perl.h
--- perl/perl.h.~1~ Wed Dec 1 10:43:52 1999
+++ perl/perl.h Wed Dec 1 10:43:52 1999
@@ -1592,6 +1592,9 @@
# define STATUS_ALL_FAILURE (PL_statusvalue = 1)
#endif
+/* flags in PL_exit_flags for nature of exit() */
+#define PERL_EXIT_EXPECTED 0x01
+
#ifndef MEMBER_TO_FPTR
#define MEMBER_TO_FPTR(name) name
#endif
==== //depot/perl/pp_ctl.c#165 (text) ====
Index: perl/pp_ctl.c
--- perl/pp_ctl.c.~1~ Wed Dec 1 10:43:52 1999
+++ perl/pp_ctl.c Wed Dec 1 10:43:52 1999
@@ -2394,6 +2394,7 @@
anum = 0;
#endif
}
+ PL_exit_flags |= PERL_EXIT_EXPECTED;
my_exit(anum);
PUSHs(&PL_sv_undef);
RETURN;
End of Patch. |
Migrated from rt.perl.org#1829 (status was 'resolved')
Searchable as RT1829$
The text was updated successfully, but these errors were encountered: