From: Florian Ragwitz Date: Mon, 22 Aug 2011 00:02:17 +0000 (+0200) Subject: Fix is_class_loaded on blead X-Git-Tag: 2.0300~118 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=20a9a879c048729baab5890223682e21181f68a6;p=gitmo%2FMoose.git Fix is_class_loaded on blead SvOK is only valid on scalars. It's pointless to call it on the result of de-referencing an arbitrary scalar. Blead recently made calling ->VERSION upgrade the scalar of the VERSION glob to a version object. This broke us as SvOK(version_object) doesn't mean what we thought it would. Just dropping the entire SvROK branch and checking for any valid scalar in the VERSION glob is the right thing to do here. --- diff --git a/xs/MOP.xs b/xs/MOP.xs index c500891..398ea4e 100644 --- a/xs/MOP.xs +++ b/xs/MOP.xs @@ -90,17 +90,9 @@ is_class_loaded(klass, options=NULL) if (hv_exists_ent (stash, KEY_FOR(VERSION), HASH_FOR(VERSION))) { HE *version = hv_fetch_ent(stash, KEY_FOR(VERSION), 0, HASH_FOR(VERSION)); SV *version_sv; - if (version && HeVAL(version) && (version_sv = GvSV(HeVAL(version)))) { - if (SvROK(version_sv)) { - SV *version_sv_ref = SvRV(version_sv); - - if (SvOK(version_sv_ref)) { - XSRETURN_YES; - } - } - else if (SvOK(version_sv)) { - XSRETURN_YES; - } + if (version && HeVAL(version) && (version_sv = GvSV(HeVAL(version))) + && SvOK(version_sv)) { + XSRETURN_YES; } }