Just to let people now, It works fine with previous version of Moose (0.98) but definitively not with >0.98.... :(
Any clue? Thanks On 06/14/2010 11:41 AM, Emmanuel Quevillon wrote: > On 06/14/2010 11:27 AM, Jesse Luehrs wrote: >> On Mon, Jun 14, 2010 at 11:20:15AM +0200, Emmanuel Quevillon wrote: >>> Hi Moose people, >>> >>> I must confess I'm not really ease with Moose behavior, but I get a >>> strange error from it when I start my perl script. >>> >>> Here it is : >>> >>> Couldn't load class (BiblioList::Abstract) because: Couldn't load >>> class (BiblioList::Root) because: BiblioList::Root already has a >>> metaclass, but it does not inherit Moose::Meta::Class >>> (Class::MOP::Class=HASH(0x2e79840)). at >>> /usr/local/lib/perl/5.10.1/Moose.pm line 166 >> >> You should include the code that's causing this error; it's not really >> possible to figure out what's wrong just from the message. Some >> possibilities include a circular dependency between use/extends/etc >> statements, or some part of the code accessing the BiblioList::Root >> class before it actually gets loaded. >> >> -doy > Hi Jesse, > > Ok, here is the hierarchy: > > ==> in script update_publications.pl : > > use BiblioList::Abstract::Updater; > > ... > > ==> Pkg BiblioList::Abstract::Updater : > > use BiblioList::Abstract::Processor; > use BiblioList::Abstract::Comparator; > ... > > ==> Pkg BiblioList::Abstract::Processor : > > ... > extends 'BiblioList::Abstract'; > ... > > ==> Pkg BiblioList::Abstract : > > package BiblioList::Abstract; > > use Moose; > > extends 'BiblioList::Root'; > > no Moose; > 1; > > > ==> Pkg BiblioList::Root : > > > package BiblioList::Root; > > use strict; > use warnings; > > use BiblioList::Config; > use BiblioList::Exception; > use BiblioList::Exception::System; > use BiblioList::Exception::FileNotFound; > use BiblioList::Exception::DBerror; > use BiblioList::Exception::ParseError; > use BiblioList::Exception::BadParameter; > > use Moose; > > has '_verbose' => ( > is => 'rw', > isa => 'Bool', > default => 0, > ); > > has '_debug' => ( > is => 'rw', > isa => 'Bool', > default => 0, > ); > > has 'config' => ( > is => 'rw', > isa => 'BiblioList::Config', > predicate => 'has_config', > default => sub { BiblioList::Config->new();}, > ); > > no Moose; > > ... > > 1; > > > > By the way, all my modules BiblioList::* have a called to > extends 'BiblioList::Root'; > > This is the way all these package are called successively : > > And here is the bottom trace thrown : > > .... > > > Moose::extends('BiblioList::Abstract') called at > /home/tuco/src/perl/projects/Catalyst/BiblioList/legiobiblio/lib/BiblioList/Abstract/Processor.pm > line 7 > require BiblioList/Abstract/Processor.pm called at > /home/tuco/src/perl/projects/Catalyst/BiblioList/legiobiblio/lib/BiblioList/Abstract/Updater.pm > line 3 > BiblioList::Abstract::Updater::BEGIN() called at > /home/tuco/src/perl/projects/Catalyst/BiblioList/legiobiblio/lib/BiblioList/Abstract.pm > line 0 > eval {...} called at > /home/tuco/src/perl/projects/Catalyst/BiblioList/legiobiblio/lib/BiblioList/Abstract.pm > line 0 > require BiblioList/Abstract/Updater.pm called at > update_publications.pl line 9 > main::BEGIN() called at > /home/tuco/src/perl/projects/Catalyst/BiblioList/legiobiblio/lib/BiblioList/Abstract.pm > line 0 > eval {...} called at > /home/tuco/src/perl/projects/Catalyst/BiblioList/legiobiblio/lib/BiblioList/Abstract.pm > line 0 > Compilation failed in require at > /usr/local/lib/perl/5.10.1/Class/MOP.pm line 114. > at /usr/local/lib/perl/5.10.1/Class/MOP.pm line 120 > Class::MOP::__ANON__('Couldn\'t load class > (BiblioList::Root) because: BiblioList::...') called at > /usr/share/perl5/Try/Tiny.pm line 98 > Try::Tiny::try('CODE(0x1555e00)', > 'Try::Tiny::Catch=REF(0x1de9978)') called at > /usr/local/lib/perl/5.10.1/Class/MOP.pm line 125 > > Class::MOP::load_first_existing_class('BiblioList::Abstract') called > at /usr/local/lib/perl/5.10.1/Class/MOP.pm line 137 > Class::MOP::load_class('BiblioList::Abstract', undef) called > at /usr/local/lib/perl/5.10.1/Moose/Meta/Class.pm line 288 > Moose::Meta::Class::superclasses(undef, > 'BiblioList::Abstract') called at > /usr/local/lib/perl/5.10.1/Moose.pm line 53 > Moose::extends('Moose::Meta::Class=HASH(0x1cf2150)', > 'BiblioList::Abstract') called at > /usr/local/lib/perl/5.10.1/Moose/Exporter.pm line 293 > Moose::extends('BiblioList::Abstract') called at > /home/tuco/src/perl/projects/Catalyst/BiblioList/legiobiblio/lib/BiblioList/Abstract/Processor.pm > line 7 > require BiblioList/Abstract/Processor.pm called at > /home/tuco/src/perl/projects/Catalyst/BiblioList/legiobiblio/lib/BiblioList/Abstract/Updater.pm > line 3 > BiblioList::Abstract::Updater::BEGIN() called at > /home/tuco/src/perl/projects/Catalyst/BiblioList/legiobiblio/lib/BiblioList/Abstract/Processor.pm > line 0 > eval {...} called at > /home/tuco/src/perl/projects/Catalyst/BiblioList/legiobiblio/lib/BiblioList/Abstract/Processor.pm > line 0 > require BiblioList/Abstract/Updater.pm called at > update_publications.pl line 9 > main::BEGIN() called at > /home/tuco/src/perl/projects/Catalyst/BiblioList/legiobiblio/lib/BiblioList/Abstract/Processor.pm > line 0 > eval {...} called at > /home/tuco/src/perl/projects/Catalyst/BiblioList/legiobiblio/lib/BiblioList/Abstract/Processor.pm > line 0 > Compilation failed in require at > /home/tuco/src/perl/projects/Catalyst/BiblioList/legiobiblio/lib/BiblioList/Abstract/Updater.pm > line 3. > BEGIN failed--compilation aborted at > /home/tuco/src/perl/projects/Catalyst/BiblioList/legiobiblio/lib/BiblioList/Abstract/Updater.pm > line 3. > Compilation failed in require at update_publications.pl line 9. > BEGIN failed--compilation aborted at update_publications.pl line 9. > t...@gin script$ > > > > But as you mentioned is it surely a circular dependency that causes > the problem. > > Thanks anyway > -- ------------------------- Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr -------------------------