[Catalyst] Inconsistent hierarchy during C3 merge of class

Wes Cravens wcravens at cortex-it.com
Sat Nov 12 18:29:54 GMT 2011


I got bit by this for the first time today... but it was my fault.  I
had implemented this kind of thingy:

# General - All case plugins
use Catalyst qw/
    ConfigLoader

    StackTrace
    ErrorCatcher
    CustomErrorMessage
/;

my @extra_plugins;

# Plugins only enabled on debug
if ( $ENV{CATALYST_DEBUG} ) {
    push @extra_plugins => qw/ Static::Simple /;
}
# Plugins to load only if not in debug
unless ( $ENV{CATALYST_DEBUG} ) {
    push @extra_plugins => qw/
        Authentication
        Session
        Session::Store::DBI
        Session::State::Cookie
    /;
}
...
__PACKAGE__->setup( @extra_plugins );

... and when doing so I had inadvertently tried to load some modules
twice.  Not sure which one's exactly but I know that loading them only
once made that C3 error go away.  Worth double checking your plugin list
for that kind of inconsistency.  In the past I've also ran afoul of
module load order.  So sometimes it may be worth re-ordering recently
added plugins in the list.

Oh - And I know that the game I'm playing above has alternative
solutions, but it solved a problem momentarily for me today.

Wes



On 3/1/2011 8:42 AM, Anne Wainwright wrote:
> Hi,
> 
> Was this issue actually resolved, the thread does not indicate so.
> 
> I also have had the same problem with the same error messages at the
> same place, but one year on from the original post.
> 
> I note that the tests and debugging on pp72-73 ran fine (last night,
> absolutely), then I ran through the changes on pp74-75 after which then
> running the tests all this hassle occurred - tests failing, server will
> not start, same error messages as Al Alders at same place.
> 
> If there is any definitive reason for this, please tell
> 
> Anne
> 
> On Wed, 24 Feb 2010 17:14:09 -0600
> Al Alder <avalder at gmail.com> wrote:
> 
>> Using Catalyst 5.80020
>> When running CATALYST_DEBUG=0 prove -l t/01app.t
>> per 'The Definitive Guide To Catalyst' page 76 I get:
>> LolCatalyst-Lite > CATALYST_DEBUG=0 prove -l
>> t/01app.t
>> t/01app.t ..
>> 1/1
>>
>> #   Failed test 'use
>> Catalyst::Test;'
>> #   at t/01app.t line
>> 7.
>> #     Tried to use
>> 'Catalyst::Test'.
>> #     Error:  Couldn't load class (LolCatalyst::Lite) because:
>> Inconsistent hierarchy during C3 merge of class
>> 'Class::MOP::Class::__ANON__::SERIAL::9': merging failed on parent
>> 'Catalyst::Plugin::Authentication' at /usr/share/perl/5.10/mro.pm
>> line 26. # Compilation failed in require
>> at /usr/local/lib/perl/5.10.0/Class/MOP.pm line 101.
>> #  at /usr/local/lib/perl/5.10.0/Class/MOP.pm line 105
>>
>> Google search turns up the fact that older versions of Catalyst had
>> this problem, but this has been fixed in
>> the latest versions.  I have checked and all modules versions appear
>> to be the latest.
>>
>> I think you guys have done an outstanding job with Catalyst and I
>> very much want to be able to use it, but
>> finding solutions to this has been very frustrating.  Any help that
>> you can offer would be greatly appreciated.
>>
>>
> 
> 
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/




More information about the Catalyst mailing list