[Moose-commits] r7576 - in Class-MOP/trunk: . t

autarch at code2.0beta.co.uk autarch at code2.0beta.co.uk
Sun Feb 8 14:46:45 GMT 2009


Author: autarch
Date: 2009-02-08 06:46:45 -0800 (Sun, 08 Feb 2009)
New Revision: 7576

Modified:
   Class-MOP/trunk/MOP.xs
   Class-MOP/trunk/t/306_is_class_loaded.t
Log:
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

Modified: Class-MOP/trunk/MOP.xs
===================================================================
--- Class-MOP/trunk/MOP.xs	2009-02-06 03:58:24 UTC (rev 7575)
+++ Class-MOP/trunk/MOP.xs	2009-02-08 14:46:45 UTC (rev 7576)
@@ -386,8 +386,7 @@
                 continue;
             }
 
-            if (!isGV(gv) || GvCV(gv) || GvSV(gv) || GvAV(gv)
-                || GvHV(gv) || GvIO(gv) || GvFORM(gv)) {
+            if (GvCV(gv)) {
                 XSRETURN_YES;
             }
         }

Modified: Class-MOP/trunk/t/306_is_class_loaded.t
===================================================================
--- Class-MOP/trunk/t/306_is_class_loaded.t	2009-02-06 03:58:24 UTC (rev 7575)
+++ Class-MOP/trunk/t/306_is_class_loaded.t	2009-02-08 14:46:45 UTC (rev 7576)
@@ -7,17 +7,11 @@
 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 @@
 
 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' );
 
+




More information about the Moose-commits mailing list