#endif
Ajnod |PerlInterpreter* |perl_alloc
Ajnod |void |perl_construct |PerlInterpreter* interp
-Ajnod |void |perl_destruct |PerlInterpreter* interp
+Ajnod |int |perl_destruct |PerlInterpreter* interp
Ajnod |void |perl_free |PerlInterpreter* interp
Ajnod |int |perl_run |PerlInterpreter* interp
Ajnod |int |perl_parse |PerlInterpreter* interp|XSINIT_t xsinit \
perl_construct(my_perl);
PL_perl_destruct_level = 0;
}
-
+ PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
exitstatus = perl_parse(my_perl, xs_init, argc, argv, (char **)NULL);
if (!exitstatus) {
- exitstatus = perl_run(my_perl);
- perl_destruct(my_perl);
- exitstatus = STATUS_NATIVE_EXPORT;
+ perl_run(my_perl);
+ exitstatus = perl_destruct(my_perl);
} else {
- perl_destruct(my_perl);
+ perl_destruct(my_perl);
}
perl_free(my_perl);
=cut
*/
-void
+int
perl_destruct(pTHXx)
{
int destruct_level; /* 0=none, 1=full, 2=full with checks */
}
#endif
- {
+
+ if(PL_exit_flags & PERL_EXIT_DESTRUCT_END) {
dJMPENV;
int x = 0;
DEBUG_P(debprofdump());
/* The exit() function will do everything that needs doing. */
- return;
+ return STATUS_NATIVE_EXPORT;;
}
/* jettison our possibly duplicated environment */
Safefree(PL_mess_sv);
PL_mess_sv = Nullsv;
}
+ return STATUS_NATIVE_EXPORT;
}
/*
LEAVE;
FREETMPS;
PL_curstash = PL_defstash;
+ if (!(PL_exit_flags & PERL_EXIT_DESTRUCT_END) &&
+ PL_endav && !PL_minus_c)
+ call_list(oldscope, PL_endav);
#ifdef MYMALLOC
if (PerlEnv_getenv("PERL_DEBUG_MSTATS"))
dump_mstats("after execution: ");
/* flags in PL_exit_flags for nature of exit() */
#define PERL_EXIT_EXPECTED 0x01
+#define PERL_EXIT_DESTRUCT_END 0x02 /* Run END in perl_destruct */
#ifndef MEMBER_TO_FPTR
# define MEMBER_TO_FPTR(name) name
#endif
PERL_CALLCONV PerlInterpreter* perl_alloc(void);
PERL_CALLCONV void perl_construct(PerlInterpreter* interp);
-PERL_CALLCONV void perl_destruct(PerlInterpreter* interp);
+PERL_CALLCONV int perl_destruct(PerlInterpreter* interp);
PERL_CALLCONV void perl_free(PerlInterpreter* interp);
PERL_CALLCONV int perl_run(PerlInterpreter* interp);
PERL_CALLCONV int perl_parse(PerlInterpreter* interp, XSINIT_t xsinit, int argc, char** argv, char** env);