From: Dave Rolsky Date: Sun, 8 Feb 2009 14:46:45 +0000 (+0000) Subject: this fix of just checking of GV-ness to determine if a class has methods defined... X-Git-Tag: 0.77~18 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0a6c6f37a8ea028db228e0bfd83c6c4b3876d67b;p=gitmo%2FClass-MOP.git this fix of just checking of GV-ness to determine if a class has methods defined seems to fix 5.8.8 with an XS MOP. it still is not quite the same as what the pure Perl version is doing. I think we are missing some tests for all this --- diff --git a/MOP.xs b/MOP.xs index b650182..38994c5 100644 --- a/MOP.xs +++ b/MOP.xs @@ -386,8 +386,7 @@ is_class_loaded(klass=&PL_sv_undef) continue; } - if (!isGV(gv) || GvCV(gv) || GvSV(gv) || GvAV(gv) - || GvHV(gv) || GvIO(gv) || GvFORM(gv)) { + if (GvCV(gv)) { XSRETURN_YES; } } diff --git a/t/306_is_class_loaded.t b/t/306_is_class_loaded.t index 40bcd83..eecc09e 100644 --- a/t/306_is_class_loaded.t +++ b/t/306_is_class_loaded.t @@ -7,17 +7,11 @@ use lib "$Bin/lib"; use Test::More; use Class::MOP (); -plan 'skip_all' => 'This test is only meaningful for an XS-enabled CMOP with Perl < 5.10' - if Class::MOP::IS_RUNNING_ON_5_10() || ! Class::MOP::USING_XS(); - - plan tests => 1; -# With pre-5.10 Perl, just defining this sub appears to shit in -# TestClassLoaded's symbol tables (see the SCALAR package symbol you -# end up with). This confuses the XS is_class_loaded method, which -# looks for _any_ symbol, not just code symbols of VERSION/AUTHORITY -# etc. +# There was a bug that manifest on Perl < 5.10 when running under +# XS. The mere mention of TestClassLoaded below broke the +# is_class_loaded check. sub whatever { TestClassLoaded::this_method_does_not_even_exist(); @@ -25,11 +19,7 @@ sub whatever { Class::MOP::load_class('TestClassLoaded'); -TODO: { - local $TODO = 'The XS is_class_loaded is confused by the bogus method defined in whatever()'; - ok( - TestClassLoaded->can('a_method'), - 'TestClassLoader::a_method is defined' - ); -} +ok( TestClassLoaded->can('a_method'), + 'TestClassLoader::a_method is defined' ); +