mPUSHs(newSVpvs("depth"));
mPUSHi(-1);
}
-
PUTBACK;
-
- call_method("throw_error", G_VOID);
+ if(SvOK(metaobject)) {
+ call_method("throw_error", G_VOID);
+ }
+ else {
+ call_pv("Mouse::Util::throw_error", G_VOID);
+ }
croak("throw_error() did not throw the error (%"SVf")", message);
}
}
+/* workaround Perl-RT #69939 */
+I32
+mouse_call_sv_safe(pTHX_ SV* const sv, I32 const flags) {
+ I32 count;
+ ENTER;
+ /* Don't do SAVETMPS */
+
+ SAVESPTR(ERRSV);
+ ERRSV = sv_newmortal();
+
+ count = Perl_call_sv(aTHX_ sv, flags | G_EVAL);
+
+ if(sv_true(ERRSV)){
+ SV* const err = sv_mortalcopy(ERRSV);
+ LEAVE;
+ sv_setsv(ERRSV, err);
+ croak(NULL); /* rethrow */
+ }
+
+ LEAVE;
+
+ return count;
+}
+
void
mouse_must_defined(pTHX_ SV* const value, const char* const name) {
assert(value);
GV* const gv = (GV*)HeVAL(he);
if(isGV(gv)){
- if(GvCVu(gv)){
+ if(GvCVu(gv)){ /* is GV and has CV */
+ hv_iterinit(stash); /* reset */
return TRUE;
}
}
- else if(SvOK(gv)){
+ else if(SvOK(gv)){ /* is a stub or constant */
+ hv_iterinit(stash); /* reset */
return TRUE;
}
}
XPUSHs(self);
PUTBACK;
- call_sv(method, G_SCALAR | G_METHOD);
+ call_sv_safe(method, G_SCALAR | G_METHOD);
SPAGAIN;
ret = POPs;
PUSHs(arg1);
PUTBACK;
- call_sv(method, G_SCALAR | G_METHOD);
+ call_sv_safe(method, G_SCALAR | G_METHOD);
SPAGAIN;
ret = POPs;
}
}
- CvGV(cv) = gv;
+ CvGV_set(cv, gv);
CvANON_off(cv);
}
}
}
{
dMY_CXT;
- if(MY_CXT.metas) croak("Cannot set metaclass storage more than once");
+ if(MY_CXT.metas && ckWARN(WARN_REDEFINE)){
+ Perl_warner(aTHX_ packWARN(WARN_REDEFINE), "Metaclass storage more than once");
+ }
MY_CXT.metas = metas;
SvREFCNT_inc_simple_void_NN(metas);
}