[Catalyst-commits] r10757 - in Catalyst-Runtime/5.80/trunk: . lib t

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Tue Jun 30 21:42:12 GMT 2009


Author: t0m
Date: 2009-06-30 21:42:11 +0000 (Tue, 30 Jun 2009)
New Revision: 10757

Added:
   Catalyst-Runtime/5.80/trunk/t/c3_appclass_bug.t
Modified:
   Catalyst-Runtime/5.80/trunk/Changes
   Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm
Log:
Test case for a way to make C3 crap itself by partially using Moose + fix.

Modified: Catalyst-Runtime/5.80/trunk/Changes
===================================================================
--- Catalyst-Runtime/5.80/trunk/Changes	2009-06-30 21:30:38 UTC (rev 10756)
+++ Catalyst-Runtime/5.80/trunk/Changes	2009-06-30 21:42:11 UTC (rev 10757)
@@ -6,6 +6,8 @@
        - Inherited controller methods can now be specified in
          config->{action(s)}
        - Assigning an undef response body no longer produces warnings
+       - Fix C3 incompatibility bug caused if you use Moose in MyApp.pm and
+         add Catalyst to the right hand side of this in @ISA.
        - Make Catalyst.pm implement the Component::ApplicationAttribute
          interface so defining actions in MyApp.pm works again, if the
          actions have attributes that cause $self->_application to be used

Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm	2009-06-30 21:30:38 UTC (rev 10756)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm	2009-06-30 21:42:11 UTC (rev 10757)
@@ -103,12 +103,13 @@
     }
 
     my $meta = Moose::Meta::Class->initialize($caller);
-    #Moose->import({ into => $caller }); #do we want to do this?
-
     unless ( $caller->isa('Catalyst') ) {
         my @superclasses = ($meta->superclasses, $class, 'Catalyst::Controller');
         $meta->superclasses(@superclasses);
     }
+    # Avoid possible C3 issues if 'Moose::Object' is already on RHS of MyApp
+    $meta->superclasses(grep { $_ ne 'Moose::Object' } $meta->superclasses);
+
     unless( $meta->has_method('meta') ){
         $meta->add_method(meta => sub { Moose::Meta::Class->initialize("${caller}") } );
     }

Added: Catalyst-Runtime/5.80/trunk/t/c3_appclass_bug.t
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/c3_appclass_bug.t	                        (rev 0)
+++ Catalyst-Runtime/5.80/trunk/t/c3_appclass_bug.t	2009-06-30 21:42:11 UTC (rev 10757)
@@ -0,0 +1,30 @@
+use strict;
+use Test::More tests => 1;
+
+{
+    package TestPlugin;
+    use strict;
+
+    sub setup {
+        shift->maybe::next::method(@_);
+    }
+}
+{
+    package TestAppC3ErrorUseMoose;
+    use Moose;
+
+    use Catalyst::Runtime 5.80;
+
+    use base qw/Catalyst/;
+    use Catalyst qw/
+        +TestPlugin
+    /;
+}
+
+use Test::Exception;
+lives_ok {
+    TestAppC3ErrorUseMoose->setup();
+} 'No C3 error';
+
+1;
+




More information about the Catalyst-commits mailing list