1 package MooseX::StrictConstructor::Meta::Method::Constructor;
9 extends 'Moose::Meta::Method::Constructor';
11 override '_generate_BUILDALL' => sub ## no critic RequireArgUnpacking
15 my $source = $self->SUPER::_generate_BUILDALL(@_);
16 $source .= ";\n" if $source;
18 my @attrs = map { $_->name() . ' => 1,' } @{ $self->attributes() };
21 my \%attrs = (@attrs);
23 my \@bad = sort grep { ! \$attrs{\$_} } keys \%params;
26 Carp::confess "Found unknown attribute(s) passed to the constructor: \@bad";
44 MooseX::StrictConstructor::Meta::Method::Constructor - A meta class to make immutable constructors strict
48 use MooseX::StrictConstructor;
52 This class simply overrides C<_generate_BUILDALL()> in
53 C<Moose::Meta::Method::Constructor> so that classes that are made
54 immutable have a strict constructor.
56 You should never have to use this class directly.
60 Dave Rolsky, C<< <autarch@urth.org> >>
62 =head1 COPYRIGHT & LICENSE
64 Copyright 2007 Dave Rolsky, All Rights Reserved.
66 This program is free software; you can redistribute it and/or modify
67 it under the same terms as Perl itself.