From: Tomas Doran Date: Mon, 16 Apr 2012 08:12:02 +0000 (+0100) Subject: We are keeping ->_plugins->{} for a reason. X-Git-Tag: 5.90012~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=1e08932999c6102add7c2abfe147d2aa7e14f1d5 We are keeping ->_plugins->{} for a reason. 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... --- diff --git a/Changes b/Changes index 71cf9bf..0dba09e 100644 --- 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 diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 0f7c25e..a2cfa74 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -2928,11 +2928,11 @@ the plugin name does not begin with C. 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; }