From: Peter Rabbitson Date: Wed, 20 Apr 2016 10:31:23 +0000 (+0200) Subject: Fix obscure failure of CDBICompat accessor install on 5.8 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1e0233457be7f60bc0a35a4913eecd7f7b7b15e8;p=dbsrgits%2FDBIx-Class.git Fix obscure failure of CDBICompat accessor install on 5.8 CDBICompat has a bizarre override of the CAG logic, in a way that only works reliably at compiletime due to Class::C3 "cache" slots A test implicitly starts covering this failcase once Class::Data::Inheritable is removed sever commits later --- diff --git a/lib/DBIx/Class/CDBICompat/ColumnGroups.pm b/lib/DBIx/Class/CDBICompat/ColumnGroups.pm index f4c8ac8..44a6010 100644 --- a/lib/DBIx/Class/CDBICompat/ColumnGroups.pm +++ b/lib/DBIx/Class/CDBICompat/ColumnGroups.pm @@ -83,7 +83,23 @@ sub _register_column_group { no strict 'refs'; my $existing_accessor = *{$class .'::'. $name}{CODE}; - return $existing_accessor && !$our_accessors{$existing_accessor}; + + return( + defined $existing_accessor + and + ! $our_accessors{$existing_accessor} + and + # under 5.8 mro the CODE slot may simply be a "cached method" + ! ( + DBIx::Class::_ENV_::OLD_MRO + and + grep { + $_ ne $class + and + ($_->can($name)||0) == $existing_accessor + } @{mro::get_linear_isa($class)} + ) + ) } sub _deploy_accessor {