1 package MooseX::StrictConstructor::Role::Meta::Method::Constructor;
10 around '_generate_BUILDALL' => sub {
14 my $source = $self->$orig();
15 $source .= ";\n" if $source;
20 map { $_->init_arg() } @{ $self->_attributes() }
24 my \%attrs = (@attrs);
26 my \@bad = sort grep { ! \$attrs{\$_} } keys \%{ \$params };
29 Carp::confess "Found unknown attribute(s) passed to the constructor: \@bad";
46 MooseX::StrictConstructor::Role::Meta::Method::Constructor - A role to make immutable constructors strict
50 Moose::Util::MetaRole::apply_metaclass_roles
51 ( for_class => $caller,
52 constructor_class_roles =>
53 ['MooseX::StrictConstructor::Role::Meta::Method::Constructor'],
58 This role simply wraps C<_generate_BUILDALL()> (from
59 C<Moose::Meta::Method::Constructor>) so that immutable classes have a
64 Dave Rolsky, C<< <autarch@urth.org> >>
66 =head1 COPYRIGHT & LICENSE
68 Copyright 2007-2008 Dave Rolsky, All Rights Reserved.
70 This program is free software; you can redistribute it and/or modify
71 it under the same terms as Perl itself.