1 package MooseX::StrictConstructor::Trait::Method::Constructor;
3 # applied as class_metaroles => { constructor => [ __PACKAGE__ ] }, for older Moose
7 use namespace::autoclean;
11 around '_generate_BUILDALL' => sub {
15 my $source = $self->$orig();
16 $source .= ";\n" if $source;
20 map { B::perlstring($_) . ' => 1,' }
22 map { $_->init_arg() } @{ $self->_attributes() }
26 my \%attrs = (@attrs);
28 my \@bad = sort grep { ! \$attrs{\$_} } keys \%{ \$params };
31 Moose->throw_error("Found unknown attribute(s) passed to the constructor: \@bad");
40 # ABSTRACT: A role to make immutable constructors strict
48 This role simply wraps C<_generate_BUILDALL()> (from
49 C<Moose::Meta::Method::Constructor>) so that immutable classes have a