We are keeping ->_plugins->{} for a reason.
Tomas Doran [Mon, 16 Apr 2012 08:12:02 +0000 (09:12 +0100)]
Use that reason to stop MRO errors. We could instead break in this case,
which I considered - however I think the behaviour I had is closer to
what was originally intended, and the simple auth helper from the book
has a habit of doing this.. If anyone feels strongly however, I'd be
entirely in favour of this becoming fatal instead...

Changes
lib/Catalyst.pm

diff --git a/Changes b/Changes
index 71cf9bf..0dba09e 100644 (file)
--- a/Changes
+++ b/Changes
@@ -9,6 +9,10 @@
   - Fix request body parameters being multiply rebuilt. Fixes both
     RT#75607 and CatalystX::DebugFilter
 
+  - Make plugin de-duplication work as intended originally, as whilst
+    duplicate plugins are totally unwise, the C3 error given to the user
+    is less than helpful.
+
  Documentation:
   - Fix documentation in Catalyst::Component to show attributes and
     calling readers, rather than accessing elements in the $self->{} hash
index 0f7c25e..a2cfa74 100644 (file)
@@ -2928,11 +2928,11 @@ the plugin name does not begin with C<Catalyst::Plugin::>.
         Class::MOP::load_class( $plugin );
         $class->log->warn( "$plugin inherits from 'Catalyst::Component' - this is deprecated and will not work in 5.81" )
             if $plugin->isa( 'Catalyst::Component' );
-        $proto->_plugins->{$plugin} = 1;
-        unless ($instant) {
+        if (!$instant && !$proto->_plugins->{$plugin}) {
             my $meta = Class::MOP::get_metaclass_by_name($class);
             $meta->superclasses($plugin, $meta->superclasses);
         }
+        $proto->_plugins->{$plugin} = 1;
         return $class;
     }