Subject: | AttributeIsRequired exception is clobbered by ClassNamesDoNotMatch exception |
With the code below, the exception produced should be AttributeIsRequired, however AttributeIsRequired is throwing the exception ClassNamesDoNotMatch. Stack trace is below.
This happens on perl 5.16.3 (perlbrew) with latest Moose 2.1204 & 2.1205
package AAA;
BEGIN {
use Moose;
}
has "bibble" => (
is => 'ro',
required => 1,
);
1;
package BBB;
BEGIN {
use Moose;
extends qw/AAA/;
}
has "dribble" => (
is => 'ro',
required => 1,
);
1;
package CCC;
use BBB;
BBB->new;
class_name (BBB) does not match class->name (AAA) at /www/Magneto/magneto_object/perlbrew/libs/perl-5.16.3@WebService/lib/perl5/x86_64-linux/Moose/Exception.pm line 37
Moose::Exception::_build_trace('Moose::Exception::ClassNamesDoNotMatch=HASH(0x2c52ad8)') called at reader Moose::Exception::trace (defined at /www/Magneto/magneto_object/perlbrew/libs/perl-5.16.3@WebService/lib/perl5/x86_64-linux/Moose/Exception.pm line 9) line 7
Moose::Exception::trace('Moose::Exception::ClassNamesDoNotMatch=HASH(0x2c52ad8)') called at /www/Magneto/magneto_object/perlbrew/libs/perl-5.16.3@WebService/lib/perl5/x86_64-linux/Moose/Exception.pm line 49
Moose::Exception::BUILD('Moose::Exception::ClassNamesDoNotMatch=HASH(0x2c52ad8)', 'HASH(0x2c529e8)') called at /www/Magneto/magneto_object/perlbrew/libs/perl-5.16.3@WebService/lib/perl5/x86_64-linux/Class/MOP/Method.pm line 128
Class::MOP::Method::execute('Moose::Meta::Method=HASH(0x2c29940)', 'Moose::Exception::ClassNamesDoNotMatch=HASH(0x2c52ad8)', 'HASH(0x2c529e8)') called at /www/Magneto/magneto_object/perlbrew/libs/perl-5.16.3@WebService/lib/perl5/x86_64-linux/Moose/Object.pm line 56
Moose::Object::BUILDALL('Moose::Exception::ClassNamesDoNotMatch=HASH(0x2c52ad8)', 'HASH(0x2c529e8)') called at /www/Magneto/magneto_object/perlbrew/libs/perl-5.16.3@WebService/lib/perl5/x86_64-linux/Moose/Meta/Class.pm line 282
Moose::Meta::Class::new_object('Moose::Meta::Class=HASH(0x2c57380)', 'HASH(0x2c529e8)') called at /www/Magneto/magneto_object/perlbrew/libs/perl-5.16.3@WebService/lib/perl5/x86_64-linux/Moose/Object.pm line 27
Moose::Object::new('Moose::Exception::ClassNamesDoNotMatch', 'class_name', 'BBB', 'class', 'Moose::Meta::Class=HASH(0x2a359b0)') called at /www/Magneto/magneto_object/perlbrew/libs/perl-5.16.3@WebService/lib/perl5/x86_64-linux/Moose/Util.pm line 52
Moose::Util::throw_exception('ClassNamesDoNotMatch', 'class_name', 'BBB', 'class', 'Moose::Meta::Class=HASH(0x2a359b0)') called at /www/Magneto/magneto_object/perlbrew/libs/perl-5.16.3@WebService/lib/perl5/x86_64-linux/Moose/Exception/AttributeIsRequired.pm line 76
Class::MOP::Class:::after('Moose::Exception::AttributeIsRequired=HASH(0x2b7b908)', 'HASH(0x20623b8)') called at /www/Magneto/magneto_object/perlbrew/libs/perl-5.16.3@WebService/lib/perl5/x86_64-linux/Class/MOP/Method/Wrapped.pm line 61
Class::MOP::Method::Wrapped::__ANON__('Moose::Exception::AttributeIsRequired=HASH(0x2b7b908)', 'HASH(0x20623b8)') called at /www/Magneto/magneto_object/perlbrew/libs/perl-5.16.3@WebService/lib/perl5/x86_64-linux/Class/MOP/Method/Wrapped.pm line 92
Moose::Exception::AttributeIsRequired::BUILD('Moose::Exception::AttributeIsRequired=HASH(0x2b7b908)', 'HASH(0x20623b8)') called at /www/Magneto/magneto_object/perlbrew/libs/perl-5.16.3@WebService/lib/perl5/x86_64-linux/Class/MOP/Method.pm line 128
Class::MOP::Method::execute('Class::MOP::Method::Wrapped=HASH(0x2c1c048)', 'Moose::Exception::AttributeIsRequired=HASH(0x2b7b908)', 'HASH(0x20623b8)') called at /www/Magneto/magneto_object/perlbrew/libs/perl-5.16.3@WebService/lib/perl5/x86_64-linux/Moose/Object.pm line 56
Moose::Object::BUILDALL('Moose::Exception::AttributeIsRequired=HASH(0x2b7b908)', 'HASH(0x20623b8)') called at /www/Magneto/magneto_object/perlbrew/libs/perl-5.16.3@WebService/lib/perl5/x86_64-linux/Moose/Meta/Class.pm line 282
Moose::Meta::Class::new_object('Moose::Meta::Class=HASH(0x20625c8)', 'HASH(0x20623b8)') called at /www/Magneto/magneto_object/perlbrew/libs/perl-5.16.3@WebService/lib/perl5/x86_64-linux/Moose/Object.pm line 27
Moose::Object::new('Moose::Exception::AttributeIsRequired', 'attribute', 'Moose::Meta::Attribute=HASH(0x2b6e5c8)', 'class_name', 'BBB', 'params', 'HASH(0x2a47358)') called at /www/Magneto/magneto_object/perlbrew/libs/perl-5.16.3@WebService/lib/perl5/x86_64-linux/Moose/Util.pm line 52
Moose::Util::throw_exception('AttributeIsRequired', 'attribute', 'Moose::Meta::Attribute=HASH(0x2b6e5c8)', 'class_name', 'BBB', 'params', 'HASH(0x2a47358)') called at /www/Magneto/magneto_object/perlbrew/libs/perl-5.16.3@WebService/lib/perl5/x86_64-linux/Moose/Meta/Attribute.pm line 494
Moose::Meta::Attribute::initialize_instance_slot('Moose::Meta::Attribute=HASH(0x2b6e5c8)', 'Moose::Meta::Instance=HASH(0x2061ea8)', 'BBB=HASH(0x2b6dbc0)', 'HASH(0x2a47358)') called at /www/Magneto/magneto_object/perlbrew/libs/perl-5.16.3@WebService/lib/perl5/x86_64-linux/Class/MOP/Class.pm line 529
Class::MOP::Class::_construct_instance('Moose::Meta::Class=HASH(0x2a404f0)', 'HASH(0x2a47358)') called at /www/Magneto/magneto_object/perlbrew/libs/perl-5.16.3@WebService/lib/perl5/x86_64-linux/Class/MOP/Class.pm line 499
Class::MOP::Class::new_object('Moose::Meta::Class=HASH(0x2a404f0)', 'HASH(0x2a47358)') called at /www/Magneto/magneto_object/perlbrew/libs/perl-5.16.3@WebService/lib/perl5/x86_64-linux/Moose/Meta/Class.pm line 278
Moose::Meta::Class::new_object('Moose::Meta::Class=HASH(0x2a404f0)', 'HASH(0x2a47358)') called at /www/Magneto/magneto_object/perlbrew/libs/perl-5.16.3@WebService/lib/perl5/x86_64-linux/Moose/Object.pm line 27
Moose::Object::new('BBB') called at t/test.t line 34