1 package MooseX::StrictConstructor::Trait::Class;
5 use namespace::autoclean;
9 around '_inline_BUILDALL' => sub {
13 my @source = $self->$orig();
17 map { B::perlstring($_) . ' => 1,' }
19 map { $_->init_arg() } $self->get_all_attributes()
24 'my %attrs = (' . ( join ' ', @attrs ) . ');',
25 'my @bad = sort grep { !$attrs{$_} } keys %{ $params };',
27 'Moose->throw_error("Found unknown attribute(s) passed to the constructor: @bad");',
32 # If the base class role is applied first, and then a superclass is added, we
34 after superclasses => sub {
39 Moose::Util::MetaRole::apply_base_class_roles(
41 roles => ['MooseX::StrictConstructor::Role::Object'],
47 # ABSTRACT: A role to make immutable constructors strict
55 This role simply wraps C<_inline_BUILDALL()> (from
56 C<Moose::Meta::Class>) so that immutable classes have a