ppp_TESTVAR(PL_debstash);
ppp_TESTVAR(PL_defgv);
ppp_TESTVAR(PL_diehook);
+#if defined(PL_phase) || defined(PL_Iphase)
+ ppp_PARSERVAR_dummy;
+#else
ppp_TESTVAR(PL_dirty);
+#endif
ppp_TESTVAR(PL_dowarn);
ppp_TESTVAR(PL_errgv);
ppp_TESTVAR(PL_laststatval);
#define PL_delaymagic (vTHX->Idelaymagic)
#define PL_destroyhook (vTHX->Idestroyhook)
#define PL_diehook (vTHX->Idiehook)
-#define PL_dirty (vTHX->Idirty)
#define PL_doswitches (vTHX->Idoswitches)
#define PL_dowarn (vTHX->Idowarn)
#define PL_dumper_fd (vTHX->Idumper_fd)
#define PL_Idelaymagic PL_delaymagic
#define PL_Idestroyhook PL_destroyhook
#define PL_Idiehook PL_diehook
-#define PL_Idirty PL_dirty
#define PL_Idoswitches PL_doswitches
#define PL_Idowarn PL_dowarn
#define PL_Idumper_fd PL_dumper_fd
/* XXX Why and where does this leave dangling pointers during global
destruction? */
- if (PL_dirty) return;
+ if (PL_phase == PERL_PHASE_DESTRUCT) return;
if (!(SvREFCNT(gv) == 1 && SvTYPE(gv) == SVt_PVGV && !SvFAKE(gv) &&
!SvOBJECT(gv) && !SvREADONLY(gv) &&
DEBUG_A(Perl_hv_assert(aTHX_ hv));
xhv = (XPVHV*)SvANY(hv);
- if ((name = HvENAME_get(hv)) && !PL_dirty)
+ if ((name = HvENAME_get(hv)) && PL_phase != PERL_PHASE_DESTRUCT)
{
/* Delete the @ISA element before calling mro_package_moved, so it
does not see it. */
PERLVAR(Idelaymagic, U16) /* ($<,$>) = ... */
PERLVAR(Ilocalizing, U8) /* are we processing a local() list? */
PERLVAR(Icolorset, bool) /* from regcomp.c */
-PERLVARI(Idirty, bool, FALSE) /* in the middle of tearing things
- down? */
PERLVAR(Iin_eval, U8) /* trap "fatal" errors? */
PERLVAR(Itainted, bool) /* using variables controlled by $< */
PERL_ARGS_ASSERT_MAGIC_CLEARISA;
/* Bail out if destruction is going on */
- if(PL_dirty) return 0;
+ if(PL_phase == PERL_PHASE_DESTRUCT) return 0;
if (sv)
av_clear(MUTABLE_AV(sv));
/* XXX DAPM for efficiency, we should only do this if we know we have
* children, or integrate this loop with general cleanup */
- if (!PL_dirty) { /* don't bother during global destruction */
+ if (PL_phase != PERL_PHASE_DESTRUCT) { /* don't bother during global destruction */
CV * const outercv = CvOUTSIDE(cv);
const U32 seq = CvOUTSIDE_SEQ(cv);
AV * const comppad_name = MUTABLE_AV(AvARRAY(padlist)[0]);
SvREFCNT_dec(PL_main_cv);
PL_main_cv = NULL;
PL_phase = PERL_PHASE_DESTRUCT;
- PL_dirty = TRUE;
/* Tell PerlIO we are about to tear things apart in case
we have layers which are using resources that should
EXTCONST char *const PL_phase_names[];
#endif
+#ifndef PERL_CORE
+/* Do not use this macro. It only exists for extensions that rely on PL_dirty
+ * instead of using the newer PL_phase, which provides everything PL_dirty
+ * provided, and more. */
+# define PL_dirty (PL_phase == PERL_PHASE_DESTRUCT)
+#endif /* !PERL_CORE */
+
END_EXTERN_C
/*****************************************************************************/
PL_restartop = proto_perl->Irestartop;
PL_in_eval = proto_perl->Iin_eval;
PL_delaymagic = proto_perl->Idelaymagic;
- PL_dirty = proto_perl->Idirty;
PL_phase = proto_perl->Iphase;
PL_localizing = proto_perl->Ilocalizing;
SV *sv;
XPVMG *any;
- if (!PL_dirty)
+ if (PL_phase != PERL_PHASE_DESTRUCT)
return newSVpvs_flags("", SVs_TEMP);
if (PL_mess_sv)
line_mode ? "line" : "chunk",
(IV)IoLINES(GvIOp(PL_last_in_gv)));
}
- if (PL_dirty)
+ if (PL_phase == PERL_PHASE_DESTRUCT)
sv_catpvs(sv, " during global destruction");
sv_catpvs(sv, ".\n");
}