const char *file;
STRLEN len;
#ifndef USE_ITHREADS
- SV * temp_sv;
+ GV *filegv;
#endif
dVAR;
gp->gp_sv = newSV(0);
#endif
-#ifdef USE_ITHREADS
+ /* PL_curcop should never be null here. */
+ assert(PL_curcop);
+ /* But for non-debugging builds play it safe */
if (PL_curcop) {
gp->gp_line = CopLINE(PL_curcop); /* 0 otherwise Newxz */
+#ifdef USE_ITHREADS
if (CopFILE(PL_curcop)) {
file = CopFILE(PL_curcop);
len = strlen(file);
}
+#else
+ filegv = CopFILEGV(PL_curcop);
+ if (filegv) {
+ file = GvNAME(filegv)+2;
+ len = GvNAMELEN(filegv)-2;
+ }
+#endif
else goto no_file;
}
else {
file = "";
len = 0;
}
-#else
- if(PL_curcop)
- gp->gp_line = CopLINE(PL_curcop); /* 0 otherwise Newxz */
- temp_sv = CopFILESV(PL_curcop);
- if (temp_sv) {
- file = SvPVX(temp_sv);
- len = SvCUR(temp_sv);
- } else {
- file = "";
- len = 0;
- }
-#endif
PERL_HASH(hash, file, len);
gp->gp_file_hek = share_hek(file, len, hash);
topgen_cmp = HvMROMETA(stash)->cache_gen + PL_sub_generation;
if (flags & GV_SUPER) {
- if (!HvAUX(stash)->xhv_super) HvAUX(stash)->xhv_super = newHV();
- cachestash = HvAUX(stash)->xhv_super;
+ if (!HvAUX(stash)->xhv_mro_meta->super)
+ HvAUX(stash)->xhv_mro_meta->super = newHV();
+ cachestash = HvAUX(stash)->xhv_mro_meta->super;
}
else cachestash = stash;
case '\015': /* $^MATCH */
if (strEQ(name2, "ATCH"))
goto magicalize;
+ break;
case '\017': /* $^OPEN */
if (strEQ(name2, "PEN"))
goto magicalize;
}
void
-Perl_gv_check(pTHX_ const HV *stash)
+Perl_gv_check(pTHX_ HV *stash)
{
dVAR;
I32 i;
return;
for (i = 0; i <= (I32) HvMAX(stash); i++) {
const HE *entry;
+ /* SvIsCOW is unused on HVs, so we can use it to mark stashes we
+ are currently searching through recursively. */
+ SvIsCOW_on(stash);
for (entry = HvARRAY(stash)[i]; entry; entry = HeNEXT(entry)) {
GV *gv;
HV *hv;
if (HeKEY(entry)[HeKLEN(entry)-1] == ':' &&
(gv = MUTABLE_GV(HeVAL(entry))) && isGV(gv) && (hv = GvHV(gv)))
{
- if (hv != PL_defstash && hv != stash)
+ if (hv != PL_defstash && hv != stash && !SvIsCOW(hv))
gv_check(hv); /* nested package */
}
else if ( *HeKEY(entry) != '_'
continue;
file = GvFILE(gv);
CopLINE_set(PL_curcop, GvLINE(gv));
- /* set file name for warning */
- CopFILE_setn(PL_curcop, file, HEK_LEN(GvFILE_HEK(gv)));
- SvREFCNT_dec(CopFILEGV(PL_curcop));
+#ifdef USE_ITHREADS
+ CopFILE(PL_curcop) = (char *)file; /* set for warning */
+#else
+ CopFILEGV(PL_curcop)
+ = gv_fetchfile_flags(file, HEK_LEN(GvFILE_HEK(gv)), 0);
+#endif
Perl_warner(aTHX_ packWARN(WARN_ONCE),
"Name \"%"HEKf"::%"HEKf
"\" used only once: possible typo",
HEKfARG(GvNAME_HEK(gv)));
}
}
+ SvIsCOW_off(stash);
}
}