From: gfx Date: Sun, 23 Aug 2009 09:30:06 +0000 (+0900) Subject: Handle magical scalars in XS X-Git-Tag: 0.92_01~13 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=704f58f985de8768eedc52541f1144ffb90cb0b5;p=gitmo%2FClass-MOP.git Handle magical scalars in XS --- diff --git a/xs/MOP.xs b/xs/MOP.xs index 85c7659..959df7a 100644 --- a/xs/MOP.xs +++ b/xs/MOP.xs @@ -43,6 +43,7 @@ get_code_info(coderef) char *pkg = NULL; char *name = NULL; PPCODE: + SvGETMAGIC(coderef); if (mop_get_code_info(coderef, &pkg, &name)) { EXTEND(SP, 2); mPUSHs(newSVpv(pkg, 0)); @@ -59,7 +60,8 @@ is_class_loaded(klass=&PL_sv_undef) HV *stash; bool found_method = FALSE; PPCODE: - if (!SvPOK(klass) || !SvCUR(klass)) { + SvGETMAGIC(klass); + if (!(SvPOKp(klass) && SvCUR(klass))) { /* XXX: SvPOK does not work with magical scalars */ XSRETURN_NO; }